- As we lead our life we have to take decisions. Similarly, as we make progress in programming and try to implement complicated logics, our program has to take decisions. But how? Well the answer is below
- if statement
- If statement is the most simple decision making statement. It is used to decide whether a certain statement or block of statements will be executed or not i.e if a certain condition is true then a block of statement is executed otherwise not.
- Here the condition is evaluated in terms of boolean values i.e. either the evaluation of condition results 1 or 0 i.e.. True(1) or False(0)
- If the condition evaluates to True(1) then the block of statements below the if statement gets executed
#1: Python example program to illustrate if statement