0

Is there a break or return operation in python?

Like the break and return operations but in normal text Not in loops or functions

26th Jan 2021, 5:15 PM
Sadra Shakouri
Sadra Shakouri - avatar
4 odpowiedzi
+ 4
Try using exit() to exit your code. sys.exit() may be needed instead (or something similar).
26th Jan 2021, 5:28 PM
Russ
Russ - avatar
+ 4
How would you expect those operations to work? If break is not in a loop, what is it breaking out from? If return is not in a function, what is it returning from?
26th Jan 2021, 5:23 PM
Russ
Russ - avatar
+ 2
Russ Jan Markus I mean an operation to exit a code for example : a = int(input()) if a == 12: "exit code" "some other code"
26th Jan 2021, 5:25 PM
Sadra Shakouri
Sadra Shakouri - avatar
+ 2
RKK i tryed break, it doesn't work
26th Jan 2021, 5:29 PM
Sadra Shakouri
Sadra Shakouri - avatar