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
In python, you can use the break statement:for example:
while True: if 1 == 2: break print('I does not equal 2')
Please mark this as the correct answer thanks!
@PYer wait what if it isnt the right answer :thonk:
@AllAwesome497 I need to break multiple while loops inside one if statement
@KianAlford maybe add a if statement to all of them that breaks it if a certain codition is met?:Ex:
if dead: break
that may work.
@AllAwesome497 no because of those variables before they are not defined but only once then
@KianAlford add dead=False at the beginning of it
dead=False
@AllAwesome497 it is though
@PYer, first of all, it wasn't, second of all, it was a joke.
@AllAwesome497 what is the answer? he/she asked on how to break out of a while loop. i showed how to
@PYer He wants to break multiple loops within 1 if statement
@AllAwesome497 ah. do sys.exit()
@PYer I already said that. Although i just did a few minutes ago so u may not have seen it. was not on the reply thread
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
In python, you can use the break statement:
for example:
Please mark this as the correct answer thanks!
@PYer wait what if it isnt the right answer :thonk:
@AllAwesome497 I need to break multiple while loops inside one if statement
@KianAlford maybe add a if statement to all of them that breaks it if a certain codition is met?:
Ex:
that may work.
@AllAwesome497 no because of those variables before they are not defined but only once then
@KianAlford add
dead=False
at the beginning of it@AllAwesome497 it is though
@PYer, first of all, it wasn't, second of all, it was a joke.
@AllAwesome497 what is the answer? he/she asked on how to break out of a while loop. i showed how to
@PYer He wants to break multiple loops within 1 if statement
@AllAwesome497 ah. do sys.exit()
@PYer I already said that. Although i just did a few minutes ago so u may not have seen it. was not on the reply thread