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.
Every programming word, explained simply โ with a pseudocode example and a real-world analogy.
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.
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.
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.
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.
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.
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.
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."
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.
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.
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.
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.
One trip around a loop.
1FOR I = 1 TO 32 DISPLAY "Round", I3END FOR ๐ Each lap around a running track.
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.
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.
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.
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.
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.
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.
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.
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.
No term matches. Try another word!
Ready to go on a fun coding adventure? First, tell me a little about you: