breaking while loops
KianAlford (7)

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 are viewing a single comment. View All
VuDo (3)

@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