1. Programming Basics
Constant – a named value that cannot change during the execution of a program
CONSTANT <identifier> = <value>
e.g.
CONSTANT MaxSize = 50
Benefits of constants:
● Chance of error/inconsistency throughout the program is minimised as value only entered once,
and then referenced throughout the program
● Makes is much easier/quicker to maintain the program if the value of a constant needs to change,
so it only has to be changed once and updates throughout the entire program where it is used
● Makes the program easier to read/understand
Variable – a named value that can change during the execution of a program
I n Pseudocode (and some other programming languages), the data type for each item must be declared
at the beginning before it can be used, and is identified by a unique name (identifier)
DECLARE <identifier> : <data type>
e.g.
DECLARE count : INTEGER
An accepted (inclusive) integer range can also be specified e.g.
DECLARE count : 1 .. 10
rocedure – a set of statements that can be grouped together and easily called in a program whenever
P
required, rather than repeating all of the statements each time - unlike a function, allows parameters to
be passed in byref
unction – a set of statements that can be grouped together and easily called in a program whenever
F
required, rather than repeating all of the statements each time - unlike a procedure, a function always
returns a value
ibrary routine – a tested and ready-to-use routine available in the development system of a
L
programming language that can be incorporated into a program
Good programming practice:
● Indentation and white space
● Use of comments
● Sensible/meaningful variable names (using Camel Case)
● Capitalisation of keywords
● Use of modular programming
● Use of local variables