Again, another hard question. So Ive got a function, and ive got a couple of try and exception in it, and basically what i need is, if those exception give me an error, i want that function to go to an end. So, how am i suppose to do this. I have tried "break", but it only works for "while", am i right? I also tried "pass" but it also doesnt work, so how can i do this? Thanks everyone.
Dan08
8
Junior Poster
Recommended Answers
Jump to Postto end a function, simply place
return
at the place where you want to break the function.for example:
def something(): try: #something except SomeError: return False
All 3 Replies
Reply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.