Codiqo

Coding terms explained

What is a variable?

In short

A variable is a name that holds a value, so your program can remember it and use it later.

Think of a variable as a label stuck on a box. You put a value in the box (a number, some text, a list) and from then on you use the label to get it back. You can also put a new value in the same box, which is why it's called a variable: what it holds can vary.

Good names make code easy to read. A name like score or user_name tells the reader what the value means; a name like x tells them nothing.

Python

Store a value, use it, then change it

score = 10
print(score)
score = score + 5
print(score)

Output

10
15

JavaScript

The same idea in JavaScript

let score = 10;
console.log(score);
score = score + 5;
console.log(score);

Output

10
15

Learn it properly

These free lessons teach it step by step, with questions and a program you write yourself.

Try your first lesson free

Codiqo teaches coding in five-minute lessons with real code. Free on the web, iPhone and Android.