๐Ÿ“–

Glossary

Every programming word, explained simply โ€” with a pseudocode example and a real-world analogy.

A

Algorithm

A step-by-step plan for solving a problem.

1BEGIN2    TAKE A, B3    SET C = A + B4    DISPLAY C5END

๐ŸŽ A recipe: follow the steps in order and you get a cake.

Argument

The actual value you give a function when you call it.

1SET TOTAL = ADD(10, 20)   // 10 and 20 are arguments

๐ŸŽ The ingredients you hand to a chef for today's dish.

Array

A numbered row of boxes that holds many values under one name.

1SET SCORES = [90, 75, 82]2DISPLAY SCORES[0]

๐ŸŽ An egg carton: one container, many numbered slots.

Assignment

Storing a value in a variable.

1SET AGE = 252SET AGE = AGE + 1

๐ŸŽ Writing a new number on a labelled whiteboard, rubbing out the old one.

B

Boolean

A value that is either TRUE or FALSE.

1SET IS_ADULT = AGE >= 182IF IS_ADULT THEN3    DISPLAY "Welcome"4END IF

๐ŸŽ A light switch: on or off, nothing in between.

C

Complexity

How much work (or memory) an algorithm needs as its input grows.

1FOR I = 1 TO N          // about N steps: O(n)2    DISPLAY I3END FOR

๐ŸŽ Reading every page of a book vs jumping straight to the index.

Condition

A question the program asks that is either TRUE or FALSE.

1IF TEMPERATURE > 30 THEN2    DISPLAY "It's hot!"3END IF

๐ŸŽ "If it rains, take an umbrella."

D

Data Structure

A way of organising data so it's easy to use.

1SET HISTORY = []2ADD "page 1" TO HISTORY3SET LAST = POP(HISTORY)

๐ŸŽ Choosing a bookshelf, a filing cabinet or a toy box depending on what you store.

F

Function

A named, reusable set of instructions.

1FUNCTION SQUARE(N)2    RETURN N * N3END FUNCTION4DISPLAY SQUARE(4)

๐ŸŽ A blender: put things in, press a button, get a smoothie out.

H

Hashing

Turning a key into a number that tells you where to store or find something.

1SET PHONE = {"Ali": "555-1234"}2DISPLAY PHONE["Ali"]

๐ŸŽ A cloakroom ticket number that tells you exactly which hook holds your coat.

I

Invariant

Something that stays true every time around a loop.

1SET TOTAL = 02FOR I = 1 TO N3    SET TOTAL = TOTAL + I   // TOTAL = 1 + โ€ฆ + I4END FOR

๐ŸŽ A seesaw kept balanced: whatever you add to one side, you match on the other.

Iteration

One trip around a loop.

1FOR I = 1 TO 32    DISPLAY "Round", I3END FOR

๐ŸŽ Each lap around a running track.

L

Loop

Instructions that repeat.

1SET N = 32WHILE N > 03    DISPLAY N4    SET N = N - 15END WHILE

๐ŸŽ Brushing each tooth one after another until all are clean.

P

Parameter

A named placeholder a function uses for the values it receives.

1FUNCTION GREET(NAME)   // NAME is a parameter2    DISPLAY "Hi", NAME3END FUNCTION

๐ŸŽ The labelled empty cups on a recipe card, waiting for ingredients.

Pseudocode

Program steps written in simple, structured English.

1BEGIN2    TAKE NAME3    DISPLAY "Hello", NAME4END

๐ŸŽ A sketch before a painting: all the ideas, none of the fuss.

R

Recursion

When a function solves a problem by calling itself on a smaller version.

1FUNCTION FACT(N)2    IF N <= 1 THEN3        RETURN 14    END IF5    RETURN N * FACT(N - 1)6END FUNCTION

๐ŸŽ Russian nesting dolls: open one, find a smaller one, until the tiniest.

Return Value

The answer a function hands back.

1FUNCTION DOUBLE(X)2    RETURN X * 23END FUNCTION4SET Y = DOUBLE(5)

๐ŸŽ The smoothie that comes out of the blender.

S

Scope

Where in a program a variable can be seen and used.

1FUNCTION F()2    SET LOCAL_X = 1   // only exists inside F3END FUNCTION

๐ŸŽ What happens in your bedroom stays in your bedroom.

Stack

A pile where the last thing added is the first taken out.

1SET PLATES = []2ADD "red" TO PLATES3ADD "blue" TO PLATES4DISPLAY POP(PLATES)   // blue

๐ŸŽ A stack of plates in a cupboard.

V

Variable

A named place where a program keeps a value.

1SET AGE = 252DISPLAY AGE

๐ŸŽ A labelled box: the label is the name, the thing inside is the value.