|
1.
|
|
|
Conditional Statements
|
|
|
|
조건문
|
|
Translated and reviewed by
baekansi
|
|
|
|
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.
|
|
|
|
렌파이에는 :ref:`jump <jump-statement>`, :ref:`call <call-statement>`, :ref:`return <return-statement>` 처럼 조건 없이 제어 흐름을 변경하는 명령문 외에 표현값에 따라 제어 흐름을 변경하는 명령문이 몇 가지 있습니다.
|
|
Translated and reviewed by
baekansi
|
|
|
|
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.
|
|
|
|
참고로 이 페이지에서는 렌파이 스크립트에서 사용할 수 있는 명령문을 설명하고 있습니다. 렌파이에 사용할 수 있는 파이썬 코드로 while, if, for 명령문이 있습니다만 이 명령문은 렌파이 스크립트로는 사용할 수 없습니다.
|
|
Translated and reviewed by
baekansi
|
|
|
|
Located in
../../source/conditional.rst:12
|
|
4.
|
|
|
If Statement
|
|
|
|
If 문
|
|
Translated and reviewed by
baekansi
|
|
|
|
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 문은 파이썬 표현식이 참이면 해당 블록에 적힌 코드를 실행합니다. if 문은 ``if`` 절 하나와, 0개 이상의 ``elif``, 때에 따라서는 ``else`` 절로 구성되어있습니다.
|
|
Translated and reviewed by
baekansi
|
|
|
|
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 by
baekansi
|
|
Reviewed by
baekansi
|
|
|
|
Located in
../../source/conditional.rst:25
|
|
7.
|
|
|
Examples are::
|
|
|
|
::
|
|
Translated and reviewed by
baekansi
|
|
|
|
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
baekansi
|
|
|
|
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
baekansi
|
|
|
|
Located in
../../source/conditional.rst:51
|
|
10.
|
|
|
While Statement
|
|
|
|
while 문
|
|
Translated and reviewed by
baekansi
|
|
|
|
Located in
../../source/conditional.rst:58
|