Skip to content

Latest commit

 

History

History
17 lines (11 loc) · 1.89 KB

ifelse.md

File metadata and controls

17 lines (11 loc) · 1.89 KB

if - else

Before we get into this we need to know about decision making.

Decision making is the anticipation of conditions occurring while execution of the program and specifying actions taken according to the conditions.

Decision making structures evaluate single or multiple expressions which produce TRUE or FALSE as outcome. You need to determine which action to take and which statements to execute if outcome is TRUE or FALSE otherwise.

Python programming language assumes any non-zero and non-null values as TRUE, and if it is either zero or null, then it is assumed as FALSE value.

Breakdown of decision making statements in the Python programming:

Sr.No. Statements & Description
1 if statements - An if statement consists of a boolean expression followed by one or more statements.
2 if...else statements - An if statement can be followed by an optional else statement, which executes when the boolean expression is FALSE.
3 elif statements - You can have an elif statement to check for another boolean expression and execute that if the boolean expression with the elif is TRUE and the is true