# if Statement

*noun*

say it: **“if STAYT-ment”** **/ɪf ˈsteɪtmənt/**

A Python statement that runs a block of code only when a condition is true.

## What is an **if statement**?

An **if statement** runs a block of code only when a condition is true.

```python
temperature = 95
if temperature > 90:
    print("Stay hydrated!")
```

## In a sentence

- “The **if statement** prints "Stay hydrated!" when it's over 90 degrees.”
- “An **if statement** checks the coupon code before taking money off.”

Level: Novice · [More Python terms at this level](https://www.ask-codey.com/glossary?category=python&level=1)

Updated: November 19, 2026

## In other subjects

- [if Statement in C#](https://www.ask-codey.com/glossary/if-statement-c-sharp)
- [If Statement in C#](https://www.ask-codey.com/glossary/if-statement-c-style)
- [if Statement in Java](https://www.ask-codey.com/glossary/if-statement-java)
- [if Statement in JavaScript](https://www.ask-codey.com/glossary/if-statement-javascript)
- [if Statement in PowerShell](https://www.ask-codey.com/glossary/if-statement-powershell)
- [if Statement in Unix](https://www.ask-codey.com/glossary/if-statement-unix)

Source: https://www.ask-codey.com/glossary/if-statement
