Problem scenario
You want to quit a function, or return out of it, when a certain condition is met. How do you do this?
Solution
This program illustrates how it is done. You will want to run the program twice, once by leaving the "5" as it is, and a second time by changing the "5" to "6".
def cool(x):
if x == 5:
return "There was equivalence"
else:
y = x
print("This statement is printing as an illustration")
return "The comparison was NOT equivalent"
var1 = cool(5)
print(var1)