I often troll the learnpython subreddit for questions from python beginners to answer. It helps me to stay sharp but also contribute to the community. Today, a post asked to explain elif statements like the person was a 5yr old. I found a great explanation on Tutorialpoint. I also expanded upon a drawing in that tutorial, you can see my edits to the image below.

Elif Statement

" The elif statement allows you to check multiple expressions for TRUE and execute a block of code as soon as one of the conditions evaluates to TRUE.

Similar to the else, the elif statement is optional. However, unlike else, for which there can be at most one statement, there can be an arbitrary number of elif statements following an if. "

Image elif

Related content