def x():
# Go through series of checks. Then in one of the conditional if statement.
if y > x:
return continue
while True:
# Bunch of class attribute updates and checks.
x()
When a function is called in a loop, if certain conditions are achieved, return a result that will make the loop go back to the beginning, as if a continue is being called.
CodePudding user response:
Just take it as a variable:
def x():
# Go through series of checks. Then in one of the conditional if statement.
if y > x:
return True
while True:
# Bunch of class attribute updates and checks.
should_continue = x()
if should_continue: continue
CodePudding user response:
make a function that return a boolean variable , then after that function invocation use if to check the variable let's make an example to clarify:
you have this function
x(){
var check=false;
...
do something
...
if(num==5){
check=true;
}
return check;
}
your loop must be something like this:
while(true){
...
...
stop=x()
if(stop==false){
group of instructions you want to skip
...
...
...
}
}