Lesson 11 of 12

Pseudocode Mapping

Throughout these lessons, you've been seeing flowcharts and pseudocode side by side. Now it's time to make the connection crystal clear. Every flowchart shape maps to a specific pseudocode pattern, and every line of pseudocode can be drawn as a flowchart shape. Once you learn these mappings, you can translate freely between the two.

Pseudocode is a way of writing out program logic in plain English, structured like code but without worrying about a specific programming language. It's the text version of a flowchart.

The Mapping Table

Here's the master reference. Each flowchart shape has a matching pseudocode pattern:

Flowchart Shape Meaning Pseudocode

Oval (Terminal)
Start or End BEGIN / END

Rectangle (Process)
Action or assignment SET x = 5
total = total + 1

Diamond (Decision)
Yes/No question IF ... THEN
WHILE ...
FOR EACH ...

Parallelogram (I/O)
Input or Output INPUT name
OUTPUT "Hello"

Pseudocode Keywords

Here are the pseudocode keywords you've learned in these lessons. They're not tied to any real programming language — they're just clear English words that describe what's happening.

BEGIN / END

Start and finish the program

SET

Create or assign a variable

INPUT

Get data from the user

OUTPUT

Show data to the user

IF / THEN / ELSE

Make a decision

WHILE / END WHILE

Loop while condition is true

FOR EACH / IN

Loop through a list

END IF

End a decision block

Putting It All Together

Here's a complete program that uses everything you've learned: variables, input, output, an if-else statement, and a while loop. It's a guessing game — the computer picks a number and you keep guessing until you get it right.

Step through the flowchart and pseudocode together. Notice how each shape in the flowchart corresponds to exactly one line (or block) in the pseudocode.

Start SET secret = 7 SET guess = 0 guess != secret? Yes "Enter guess:" INPUT guess guess < secret? Yes "Too low!" No "Too high!" No "Correct! You got it!" End
BEGIN
  SET secret = 7
  SET guess = 0
  WHILE guess != secret
    OUTPUT "Enter your guess:"
    INPUT guess
    IF guess < secret THEN
      OUTPUT "Too low!"
    ELSE
      OUTPUT "Too high!"
    END IF
  END WHILE
  OUTPUT "Correct! You got it!"
END

Variable Watch

VariableValue
Step through to see variables

This program combines variables (secret, guess), input/output (asking for guesses, showing hints), a while loop (keep guessing until correct), and an if-else (is the guess too low or too high?). Every concept from the previous lessons works together!

Translation Rules: Flowchart to Pseudocode

When you want to convert a flowchart into pseudocode, follow these steps:

  1. Start at the top — write BEGIN.
  2. Follow the arrows — each shape becomes one line (or block) of pseudocode.
  3. Rectangles become assignment statements: SET x = value
  4. Parallelograms become INPUT or OUTPUT statements.
  5. Diamonds become IF, WHILE, or FOR EACH — look at whether the No arrow goes forward (it's an if) or backward (it's a loop).
  6. Indent everything inside an if-block or loop body.
  7. End at the bottom — write END.

The big clue for loops vs. decisions: If a diamond has an arrow that goes back up in the flowchart, it's a loop. If all arrows go forward/down, it's an if statement.

Translation Rules: Pseudocode to Flowchart

Going the other direction — pseudocode to flowchart — use these rules:

  1. BEGIN and END become oval shapes at the top and bottom.
  2. SET / assignment statements become rectangles.
  3. INPUT / OUTPUT become parallelograms.
  4. IF ... THEN becomes a diamond with Yes and No arrows going forward.
  5. WHILE ... becomes a diamond with the Yes arrow going to the loop body and the No arrow going forward. At the end of the loop body, draw an arrow back up to the diamond.
  6. FOR EACH ... IN ... works the same way as while — diamond with a back arrow.
  7. Connect everything with arrows, flowing top to bottom.

Quick Reference Card

Here's a cheat sheet showing each structure as both a mini flowchart and pseudocode:

If Statement

IF condition THEN
  do something
END IF

Diamond with one action on the Yes path. No path skips ahead.

If-Else Statement

IF condition THEN
  do this
ELSE
  do that
END IF

Diamond with actions on both Yes and No paths.

While Loop

WHILE condition
  do something
  update variable
END WHILE

Diamond with a back arrow from the loop body. Needs an update step.

Foreach Loop

FOR EACH item IN list
  do something with item
END FOR EACH

Diamond asking "more items?" with back arrow. No counter needed.

Key Takeaways

  • Every flowchart shape maps directly to a pseudocode pattern — and vice versa.
  • Ovals = BEGIN / END. Rectangles = assignments. Parallelograms = INPUT / OUTPUT. Diamonds = decisions or loops.
  • The key difference between a decision and a loop: loops have a back arrow, decisions don't.
  • You can translate in either direction once you know the mappings.
  • Real programs combine multiple structures together — and now you know how to read all of them!

Congratulations! You've completed all the lessons. You now know how to read and create flowcharts for all the core programming concepts. Head over to the Flowchart Builder to practice making your own diagrams!