Skip to main content

#mastery15 Use of the conditional “if”

1 min read

What the "if" does is that if a condition is fulfiled it will do what it is inside of it.

An example of this is

num=1+1

if (num>3):

print ("Hello") must be idented so it can be part of the if

This program wont print anything because the condition num>3 is not fulfiled , in order for it to print something it must be num<3 or num=2 because num equals 2

num=1+1

if (num<3):

print("Hello") must be idented so it can be part of the if

This program will show the user:

Hello the condition is now fulfiled (2<3)