Hands-On Science Lab

Glossary โ€บ Coding โ€บ Variable (in coding)

Variable (in coding)

A named box that holds a value which can change.

For kids

In a game, 'lives' is a variable. It starts at 3, goes down when you're hit, and up when you find a heart.

For grown-ups

Variables store data that programs use and update. They have names and values, and can hold numbers, text or true/false. Board games with lives and coins are a perfect unplugged model.

Try it in one minute

Keep score in a family game on paper. The score is a variable.

Common mix-up

In science, a 'variable' means something you change or measure in an experiment.

See it in an activity