if Statement Use in Python

When an expression is true in an if statement then it executes its statement and if the expression is false then it is not executed.

As long as the expression given by these control statements is not true, then it is its own statement; does not execute.

Use If statement in Python, How to use If Statement in Python

Syntax of if Statement

if expression :

Example of if Statement Source Code :

x = 2
y = 3
if(x < y) :
print("x is less than y")

Output :

x is less than y