Вы находитесь на странице: 1из 2

Variables

Variables are used to store values during the execution of a program.


Data Types
Integer used to store positive or negative whole numbers uses 2 bytes to store the
number.
Single (often called real) used to store decimals - 4 bytes floating point number.
String used to store alphanumeric (text and numbers) characters.
Boolean stores either the value TRUE or FALSE.
Long stores a 4-byte integer.
Double stores an 8-byte floating-point number
Arrays are used to store a group of like variables. For example:
To store the names of 20 pupils in class you would use an array of 20 strings.
To store a list of five test marks for a pupil you would use an array of 5 integers.
Exercise1



There are two types of variables
1. Global Variable
Global variables can be accessed throughout the program and should be declared at the
beginning of the program code.

2. Local Variable
Local variables are used within a single sub procedure or function of a program. It is good
practice to use local variables whenever possible.

You could have two local variables in different sub procedures in a program with the
same name and they would not affect each other.

Вам также может понравиться