Assume I have the following ;
def test():
while 1:
a = b
time.sleep(60)
c = b
if(c==a):
do something
then quit the function
What is the proper way to quit from a function having this structure ?
You could just use a
returnstatement.That would be the most direct way, by just placing the
returnwhere you want to quit (“then quit the function”).You could also use this to return any results you have to the calling code.
Eg.,
return some_resultsPython doc for return