Skip to main content

If Condition AST Python Object

The IfCondition object matches a Python function, module or object call.

The astType value for this node is ifstatement.

Code Pattern

This AST element captures the following code.

if condition:
... <statements> ...
elif ...:
... <elseStatement> ...


  • condition (type PythonComparison): comparison in the if
  • statements (type AstString): the statement for the if part
  • elifStatements (array of PythonElifStatement): all elif statements
  • elseStatement (type AstString): the code of the else statements