Python's Syntax
Christophe Delord
christophe.delord at free.fr
Fri Mar 1 12:22:50 EST 2002
Hi,
If your question is about block separators, just read the documentation
for further details : http://www.python.org/doc/current/ref/indentation.html
Lines with the same indentation are in the same block:
if condition:
inst1 # do this if true
inst2 # do this if true
else:
inst3 # do this if false
inst4 # always do this
David Russell wrote:
> Hi,
>
> I can't get my head around Python's syntax for the if, for, while etc.
> statements.
>
> I'm used to the classic:
>
> if (condition == TRUE)
> {
> Do this
> }
> else
> {
> Do this
> }
>
> I've had a look at a couple of tutorials for Python and it appears like
> this:
>
> if condition == TRUE:
> do this
>
>
> How do you tell it when to stop? I just can't figure out how to do it. Could
> somebody explain it to me please, even though I have a strange suspicious
> that it is one of the simplest deatils imaginable.
>
> Also, another thing about Python's syntax. Are statements just sperated by
> their lines, or do they have some form of seperator (like a semi-colon)?
>
>
> Thanks for any help, it is appreciated.
>
> (Sorry if this appears twice, the first time I sent it I got an error so I'm
> not sure if both will show up)
>
>
>
>
>
>
--
Christophe Delord
http://christophe.delord.free.fr/
More information about the Python-list
mailing list