I'm currently trying to make an RP game. all I need to do is break a few while loops. but a certain amount of times every time. I can't figure out how to do it.
@KianAlford like others had suggested, break at different loops. You could use controlled variables. e.g. isAlive = true
while isAlive
while isAlive and doSomething #to break, set isAlive = false then use break statement #if necessary, use if !isAlive: break immediately after the while loop if you #to prevent codes not inside the loop from running
I'm currently trying to make an RP game. all I need to do is break a few while loops. but a certain amount of times every time. I can't figure out how to do it.
https://repl.it/@KianAlford/RPG-adventure-1
you could also make it so x!=1
@AllAwesome497 no. I'm wondering how to break 2 while loops. like at the end. I need to break 3 while loops on that if statement. only if that happens
@KianAlford like others had suggested, break at different loops. You could use controlled variables. e.g. isAlive = true
while isAlive
#to break, set isAlive = false then use break statement
#if necessary, use if !isAlive: break immediately after the while loop if you
#to prevent codes not inside the loop from running
@VuDo i will try this thx
@VuDo that would logically make no sense tho. because it only needs to tell if true or false inside that if statement. nowhere else.