[Tutor] else syntax error problem
Deirdre Saoirse
deirdre@deirdre.net
Mon, 5 Jun 2000 14:56:48 -0700 (PDT)
On Mon, 5 Jun 2000, Nigel Pauli wrote:
> >>> for i in range(10,-1,-1):
> if i != 0:
> print i
> else:
>
> SyntaxError: invalid syntax
> >>>
>
> What should continue after else is...
> print "Blastoff!"
>
> What it looks like is that the part of python that handles else and elif
> is missing - but that's daft, isn't it? Is it significant that that else:
> below print i isn't hanging indented to be back underneath the if 2 lines
> above?
Yes. It needs to be at the same indentation level as the if.
--
_Deirdre * http://www.sfknit.org * http://www.deirdre.net
"Linux means never having to delete your love mail." -- Don Marti