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.
sentense
if <conditional statement>:
<syntax>
if <conditional statement 1>:
<Syntax 1>
elif <conditional statement 2>:
<Syntax 2>
else:
<Syntax 3>
Example - if, elif, else
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