If you click on this post…

--Originally published at Py(t)hon

This time we are going to see   the conditional if and how does it work. The conditionals statement performed different actions depending on how the boolean was evaluated false or true. The general form of the “if” statement is the follow.

If BOOLEAN :

STATEMENTS

There are some important things to remember about the if statement when use:

  • The colon (:) is required. It separates the header from the body.
  • The line after the colon must be indented. It is standard in Python to use four spaces for indenting.
  • All lines indented the same amount after the colon will be executed whenever the BOOLEAN_EXPRESSION is true.

Here is an example:

if-1

Here is a tutorial if you didn’t get it:

That’s all #Pug#Tec#ISC#If#Python#Basic