|
1.
|
|
|
Conditional Statements
|
|
|
|
Условные операторы
|
|
Translated and reviewed by
theadmin
|
|
|
|
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 вклюает несколько операторов, изменяющих поток программы в зависимости от выражений. Это дополняет выражения :ref:`jump <jump-statement>`, :ref:`call <call-statement>` и :ref:`return <return-statement>`, изменяющих поток безусловно.
|
|
Translated and reviewed by
theadmin
|
|
|
|
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.
|
|
|
|
Следует заметить, что эта страница обсуждает операторы, используемые языком Ren'Py. Код на Python, встроенный в игры Ren'Py, должен использовать операторы Python (while, if и for).
|
|
Translated and reviewed by
theadmin
|
|
|
|
Located in
../../source/conditional.rst:12
|
|
4.
|
|
|
If Statement
|
|
|
|
Оператор Если
|
|
Translated and reviewed by
theadmin
|
|
|
|
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.
|
|
|
|
Оператор if выполняет блок кода, если представленное выражение Python истинно. Он содержит ровно один ``if``, ноль или более ``elif`` и один необязательный ``else``.
|
|
Translated and reviewed by
theadmin
|
|
|
|
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. (:)
|
|
|
|
Каждая часть оператора должна находится на своей линии, и за ней должен следовать блок операторов. После ``if`` и ``elif`` следует выражение. Все части оператора заканчиваются двоеточием. (:)
|
|
Translated and reviewed by
theadmin
|
|
|
|
Located in
../../source/conditional.rst:25
|
|
7.
|
|
|
Examples are::
|
|
|
|
Примеры::
|
|
Translated and reviewed by
theadmin
|
|
|
|
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.
|
|
|
|
Выражения в операторе if исследуются по порядку, с первого до последнего. Когда выражение является истинным, соответствующией ему блок выполняется. Когда управление достигает конца блока, оно переходит к части оператора if, следующей за ним.
|
|
Translated and reviewed by
theadmin
|
|
|
|
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.
|
|
|
|
Если все выражения ложны, блок, связанный с ``else`` будет выполнен, если ``else`` присутствует.
|
|
Translated and reviewed by
theadmin
|
|
|
|
Located in
../../source/conditional.rst:51
|
|
10.
|
|
|
While Statement
|
|
|
|
Оператор Пока
|
|
Translated and reviewed by
theadmin
|
|
|
|
Located in
../../source/conditional.rst:58
|