← Dictionary
Code·basic

Variable

A named slot that holds a value. Everything else in code is built on these.

A variable is a label you give to a piece of data so you can use it again.

name = "Stella"
age = 18
colors = ["red", "green", "blue"]

After those three lines, name, age, and colors all point to their values. You can print them, change them, pass them to functions, or use them in conditionals.

The whole point is reuse. If you'll mention someone's name three times, store it in a variable once. If the name changes, you change it in one place.

Related