A piece of code that repeats, a loop. One of the four main programming constructs, we use WHILE or FOR to code it
Selection
When the code makes a choice, usually with an "IF" statement. One of the four main programming constructs
Sequence
Two or more lines of code that are executed in order, top to bottom. One of the four main programming constructs
Subroutine
A section of code that performs a particular task, a function or procedure, one of the four main programming constructs
variable
A named memory location holding a value that can change during a program, it can be global or local
function
A type of subroutine that executes a block of code and then returns a value
procedure
This subroutine executes a block of code that performs a useful process but does not return a value
global
Variables of this type remain in memory even when a subroutine ends, their scope is the whole program
local
Variables with limited scope, they are usually deleted when the subroutine ends, thus saving memory and preventing errors
scope
The portion of a program in which a local variable is usable, usually the subroutine where it is declared
parameter
A variable declared in a subroutine definition, a and b are parameters in this code:SUBROUTINE add(a, b) result ← a + b RETURN resultENDSUBROUTINE
Call
A line of code that causes a subroutine to run by using its name, for example answer ← add(2, 3) will run the function "add" and store the result in the variable "answer"
Structured programming
Dividing a task into smaller tasks before coding, and writing each sub-task as a subroutine. It makes debugging and maintenance easier