- String – a set of characters eg. SK15 2PK
- Integer – a whole number eg. 134
- Floating Point or Real – numbers that can include decimal points eg. 13.45
- Char – a single character eg. x
- Boolean – either True or False eg. True
Static and Dynamic
Static – a variable that keeps the same value throughout the program eg. pi
Dynamic – a variable that contains a value that can change in the program eg. score
Local and Global
Local variables are variables that only exist inside a subroutine (method).
Global variables are variables that are declared outside of a subroutine and that can be accessed anywhere in the program.
output "Welcome to the Area and Volume calculator" area = 0 # global variable, it can be accessed anywhere in the program declare subprocedure RecArea length is integer # local variable, only accessible in the subroutine width is integer input length input width area = length * width declare subprocedure CircleArea radius is integer # dynamic variable, it can change pi is integer # static variable - it does not change input radius pi = 3.14 area = R**2 *pi start is string input start if start = "Rectangel" call RecArea() elif start = "Circle" call CircleArea() output "The area is",area,"metres squared"