|
1.
|
|
|
Conditional Statements
|
|
|
|
Conditional Statements
|
|
Translated and reviewed by
Stephan Woidowski
|
|
|
|
Located in
../../source/conditional.rst:5
|
|
2.
|
|
|
Ren'Py includes several statements that can alter control flow based on expression values. (This is in addition to the :ref:`jump <jump-statement>`, :ref:`call <call-statement>` and :ref:`return <return-statement>` statements, which transfer control unconditionally.
|
|
|
|
Ren'Py includes several statements that can alter control flow based on expression values. (This is in addition to the :ref:`jump <jump-statement>`, :ref:`call <call-statement>` and :ref:`return <return-statement>` statements, which transfer control unconditionally.
|
|
Translated and reviewed by
Stephan Woidowski
|
|
|
|
Located in
../../source/conditional.rst:7
|
|
3.
|
|
|
Note that is pages discusses statements that can be used inside Ren'Py script. Python code embedded in a Ren'Py game uses the Python while, if, and for statements, but can't embed Ren'Py script code.
|
|
|
|
Note that is pages discusses statements that can be used inside Ren'Py script. Python code embedded in a Ren'Py game uses the Python while, if, and for statements, but can't embed Ren'Py script code.
|
|
Translated and reviewed by
Stephan Woidowski
|
|
|
|
Located in
../../source/conditional.rst:12
|
|
4.
|
|
|
If Statement
|
|
|
|
If Statement
|
|
Translated and reviewed by
Stephan Woidowski
|
|
|
|
Located in
../../source/conditional.rst:19
|
|
5.
|
|
|
The if statement conditionally executes a block of code if a python expression is true. It consists of an ``if`` clause, zero or more ``elif`` clauses, and an optional``else`` clause.
|
|
|
|
The if statement conditionally executes a block of code if a python expression is true. It consists of an ``if`` clause, zero or more ``elif`` clauses, and an optional``else`` clause.
|
|
Translated and reviewed by
Stephan Woidowski
|
|
|
|
Located in
../../source/conditional.rst:21
|
|
6.
|
|
|
Each clause should be on its own logical line, followed by a block of statements. The ``if`` and ``elif`` clauses are followed by an expression, while all clauses end with a colon. (:)
|
|
|
|
Each clause should be on its own logical line, followed by a block of statements. The ``if`` and ``elif`` clauses are followed by an expression, while all clauses end with a colon. (:)
|
|
Translated and reviewed by
Stephan Woidowski
|
|
|
|
Located in
../../source/conditional.rst:25
|
|
7.
|
|
|
Examples are::
|
|
|
|
Examples are::
|
|
Translated and reviewed by
Stephan Woidowski
|
|
|
|
Located in
../../source/conditional.rst:29
|
|
8.
|
|
|
The expressions in the if statement are evaluated in order, from first to last. When an expression evaluates to true, the block corresponding to that statement is executed. When control reaches the end of the block, it proceeds to the statement following the if statement.
|
|
|
|
The expressions in the if statement are evaluated in order, from first to last. When an expression evaluates to true, the block corresponding to that statement is executed. When control reaches the end of the block, it proceeds to the statement following the if statement.
|
|
Translated and reviewed by
Stephan Woidowski
|
|
|
|
Located in
../../source/conditional.rst:45
|
|
9.
|
|
|
If all expressions evaluate to false, the block associated with the ``else`` clause is executed, if the ``else`` clause is present.
|
|
|
|
If all expressions evaluate to false, the block associated with the ``else`` clause is executed, if the ``else`` clause is present.
|
|
Translated and reviewed by
Stephan Woidowski
|
|
|
|
Located in
../../source/conditional.rst:51
|
|
10.
|
|
|
While Statement
|
|
|
|
While Statement
|
|
Translated and reviewed by
Stephan Woidowski
|
|
|
|
Located in
../../source/conditional.rst:58
|