Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 help with a While loop...invalid syntax?
Index -> Programming, Python -> Python Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Joeltron




PostPosted: Mon Feb 27, 2012 12:02 pm   Post subject: help with a While loop...invalid syntax?

Im having trouble with a While loop inside an if statement. I keep getting an error: invalid syntax at battleNotdone. I want the code to see who goes first, and loop the turns starting with that person. there is code in the functions to give battleNotdone a value ending the loop.

I am new to python, and im not sure whats going on here. ive searched and found nothing online. I can post the whole program if that would help. Im trying to make a program to imitate a battle. its loosely based on DnD and the d20 system. It started as a test of my beginner skills and keeps evolving to be slightly more complex.

code:
battleNotdone = 0
if playerRoll > enemyRoll:
    print player.name, "goes first", "\n"
    While battleNotdone == 0:
        yourTurn()
        enemyTurn()
Sponsor
Sponsor
Sponsor
sponsor
Dreadnought




PostPosted: Mon Feb 27, 2012 12:13 pm   Post subject: Re: help with a While loop...invalid syntax?

Most keywords do not have the first letter capitalized. In this case, "While" should be written "while".
Joeltron




PostPosted: Mon Feb 27, 2012 12:30 pm   Post subject: Re: help with a While loop...invalid syntax?

Thank you very much. such a little detail, good eye!
Display posts from previous:   
   Index -> Programming, Python -> Python Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: