Python's Syntax

Justin Sheehy justin at iago.org
Fri Mar 1 12:18:22 EST 2002


"David Russell" <webmaster at greich.co.uk> writes:

> 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.

Just return to the previous indent level.

For instance:

if test:
    line1
    line2
    line3
line4

Lines 1-3 will be executed inside the if clause, and line4 follws it.

Python's logical blocks are delimited by indentation.

> 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)?

Either.

You may place multiple statements on one line and delimit them with a
semicolon. 

-Justin

 





More information about the Python-list mailing list