In this article, we will be covering IF statement in Python.
In Python, we can use IF statement to evaluate a condition to change conditional code flow. In python, unlike other programming languages like C# C or variants and Java, Python uses tab spaces rather curly brackets and differs from others as syntax.
Syntax of IF statement in Python is as follows:
#if statement in python
var = 1
if(var == 1):
print("var is 1")
else:
print(" var is not 1")
In above syntax, pyhton compiler evaluates condition and if conditional statement returns TRUE, it evaluates first print, in FALSE executes the second print from else statement.
Output of above Python syntax example: