Programming for Kids - ZedLX

The Easiest Way to Learn Computer Programming

Variables [1/14]


A variable is a name that can be associated to a value.

A variable must be introduced before it is used.

Variables are introduced by a statement of new variables. A statement of new variables begins with the symbol #.

Each variable must be of some type. In this example, the variable x is of type num. In other words, the first statement introduces a variable named x of type num, with initial value of 10.

The type num is used for numbers. Therefore, the variable x cannot be assigned anything but a number. For example, a string cannot be assigned to x.

The value of a variable can be changed. In this example, the variable x was equal to 10 at the start, but later its value was changed to 3.