How Logic Works

If/Then Condition

A decision point in code.

Definition

A decision point in code. The program checks whether something is true, and if it is, it runs a specific block of code. If not, it can do something else. This is how programs make choices.

Example

if temperature > 90: print('It is hot outside') — the program checks the temperature and only prints the message if the condition is true.

See it in context Learn how If/Then Condition fits into the bigger picture of how software actually works.

Read the Guide →