31 lines
747 B
Markdown
31 lines
747 B
Markdown
---
|
||
title: statements
|
||
tags:
|
||
- python
|
||
- statements
|
||
- syntax
|
||
aliases:
|
||
- statement
|
||
- code-line
|
||
---
|
||
|
||
> [!note] Concept
|
||
> A **statement** performs an action. It could assign a value, call a function, define something, or control flow.
|
||
>
|
||
> > [!example] Examples
|
||
> > ```python
|
||
> > x = 10 # assignment statement
|
||
> > print("Hello") # function call statement
|
||
> > if x > 5: # control statement
|
||
> > print(x)
|
||
> > ```
|
||
>
|
||
> > [!important] Statement vs Expression
|
||
> > - An **expression** evaluates to a value.
|
||
> > - A **statement** does something — it doesn’t always return a value.
|
||
>
|
||
> > [!info] Related Notes
|
||
> > [[expressions]]
|
||
> > [[functions]]
|
||
> > [[conditionals]]
|
||
> > [[pythonSyntaxOverview]]
|