Variables and constants, data types, sequence, selection and iteration, arrays, and procedures and functions.
Variables, constants and data types
A variable is a named storage location whose value can change while the program runs.
A constant holds a value that does not change (e.g.
Pi ← 3.142).Declaring a variable reserves it and (in many languages) sets its data type.
| Data type | Stores | Example |
|---|---|---|
| Integer | whole numbers | 42, -7 |
| Real | numbers with a decimal point | 3.14 |
| Char | a single character | 'A' |
| String | text (sequence of characters) | "Hello" |
| Boolean | TRUE or FALSE | TRUE |
Viewing only
This content is free to read on superexams.com and cannot be printed or downloaded.
Read the full note — free
Create a free account to read this note in full. Every free account gets 2 complete revision notes — no card needed.