for example i have def Hello():
and here is the code
def Hello():
F = 'Y'
if F == 'Y':
#here i want get out of the Hello() to Hey()! by how!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
To exit the ‘Hello’ function:
You can use ‘return’ to exit a function before the end (though there is a school of thought that frowns on this, as it makes it slightly harder to form a solid picture of the execution flow).
This will go on to the ‘Hey’ function if you called it with e.g.:
Or, to ‘jump’ to the ‘Hey’ function, use:
…but this means the call stack will still contain the data for the ‘Hello’ function – so when you return from the ‘Hey’ function, you will be returning to within the ‘Hello’ function, and then out of that.