![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programmer
Join Date: Nov 2005
Location: Estonia
Posts: 97
Rep Power: 0
![]() |
Branching&loops problem
I have some if and elif statements that I use multiple times so I put them in a def. Now I have a while loop whic start with the defdfunction() and then has elif statements (because the if statement is in the defdfunction) but python says that the firs elif in the while loop is an error.
Here's an example: http://rafb.net/paste/results/ZXY1lI53.html |
|
|
|
|
|
#2 |
|
Programming Guru
![]() Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5
![]() |
elif and else statements are subsections of an if block. You can't move the if statement away from the elif blocks.
You probably want something like: if something:
...
else:
while whatever:
if first_elif_condition:
...
elif second_elif_condition:
...Last edited by Arevos; Jun 15th, 2006 at 6:55 AM. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|