Next / Previous / Contents / TCC Help System / NM Tech homepage

14. Compound statements

For branching statements, B is a block of all the statements that are indented further, up to but not including the next statement that is not indented further; blank lines don't count.

You can put the block B on the same line as the branching statement, after the colon (:). Multiple statements can be so placed, with semicolons (;) separating them.

14.1. Boolean values: true and false

In the sections below on the “if” and “while” statements, we speak of values being true or false. For Python's purposes, the following values are considered false:

  • Any number equal to zero: 0, 0.0, 0L, 0j.

  • Any empty sequence (such as the empty list “[]” or the empty tuple “()”).

  • An empty mapping, such as the empty dictionary “{}”.

  • The special value None.

Any other value is considered true.