Skip to content

Latest commit

 

History

History
17 lines (11 loc) · 974 Bytes

File metadata and controls

17 lines (11 loc) · 974 Bytes

If, Elif and Else

![If, Elif and Else](/assets/chapter_3_assets/If, Elseif and Else.png)

####If The If statement performs an action(s) if the condition is true; otherwise, it skips the action(s).

####Elif The Elif statement is an extension of the If statement and may only be used following it.

When used together, the statements perform an action(s) if the condition is true; otherwise, the Elif statement checks for the second condition. If the second condition is true, it performs an action(s); otherwise, it skips the action(s).

This statement is used to create multiple levels of conditionals with a hierarchy that determines the sequence of checks performed.

####Else The Else statement is an extension of the If or Elif statement and may only be used following either.

When used together, the statements perform an action(s) if the condition is true; otherwise, it performs a different action(s) over the items that are excluded from the first condition.