AI engineering glossary · Python core
What is if statement?
if statement (also called if/elif/else, conditional statement): A control-flow statement that runs a block of code only when its condition is true. It can be extended with elif branches for extra conditions and an else branch for the remaining case. Python checks the branches in order and runs the first match only.
if statement: an example
if marks >= 75: grade='A' elif marks >= 60: grade='B' else: grade='C'. With marks 68 the grade becomes 'B'.
Related terms
More Python core terms
Where you learn it
if statement is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.