3.7.0 3.6.0 3.5.0 3.4.0 3.3.0 3.2.2 3.2.1 3.2.0 Korean English Chinese Czech Dutch French German Hungarian Italian Japanese Polish Portuguese Spanish
3.7.0 3.6.0 3.5.0 3.4.0 3.3.0 3.2.2 3.2.1 3.2.0 Korean English Chinese Czech Dutch French German Hungarian Italian Japanese Polish Portuguese Spanish

if

Features

‘if’ is a conditional statement. It can use "elif" and "else" according to whether the condition of the "if" syntax is true or false.

sentence

if <conditional statement>:

      <syntax>

 

if <conditional statement 1>:

      <Syntax 1>

elif <conditional statement 2>:

      <Syntax 2>

else:

      <Syntax 3>

Example - if, elif, else

Python
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