Skip to main content
Skip table of contents

if

기능

조건문 함수로 if 문의 조건식에 참인가 거짓인가에 따라 elifelse를 사용할 수 있습니다.

문법

if <조건식>:

   <구문>

 

if <조건식1>:

   <구문1>

elif <조건식2>:

      <구문2>

else:

      <구문3>

예제 - if, elif, else

PY
numbers = [2,5,7]
for number in numbers:
if number%2==0:
tp_log(str(number) + " is even")
else:
tp_log (str(number) + " is odd")
#expected result:
#2 is even
#5 is odd
#7 is odd
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.