[Tutor] Exiting a while

Amit Saha amitsaha.in at gmail.com
Sat Jul 6 05:38:48 CEST 2013


On Sat, Jul 6, 2013 at 1:33 PM, Jack Little <jacklittlemc at yahoo.com> wrote:
> How would I exit a while statement. The while is to keep the player in
> combat with an enemy until said enemy is dead. I tried using an if, but it
> just doesn't work.

The 'break' statement can help you. While you are there, also learn
about 'continue'.

Here is the doc:
http://docs.python.org/2/tutorial/controlflow.html#break-and-continue-statements-and-else-clauses-on-loops


--
http://echorand.me


More information about the Tutor mailing list