โ† All labs

Variables and Functions

Level 2 ยท Learn It

1. Learn It
2. Try It
3. Quiz Me

A variable is like a labeled box that stores information a program can use and change, such as a player's score or name.

For example, a variable called 'score' might start at 0 and go up by 1 each time you collect a coin in a game.

A function is a group of instructions with a name, so you can reuse it whenever you need it, instead of rewriting the same steps.

For example, a function called 'jump()' could contain all the steps to make a character jump, and you can call it anytime a jump is needed.

Casey, your friendly science guide
Ready? Let's try one together โ€” I'll explain every answer.