🧠 Mermaid.live – Building an Algorithm flow chart

Mermaid turns diagram code into a flowchart. You write the structure. Mermaid builds the shapes.

πŸš€ Step 1: Open Mermaid.live

https://mermaid.live

Left = code editor
Right = diagram preview

🎯 What this example models

This example shows how a while loop works:

  1. Start
  2. Ask for a number
  3. Check if number is < 5
  4. If yes β†’ add 1 and repeat
  5. If no β†’ end

The arrow that goes back to the decision creates repetition.

πŸ”· Shape Guide

([ ]) β†’ Start / End
[ ] β†’ Process
{ } β†’ Decision
[/ /] β†’ Input / Output

πŸ–Ό Example Flow chart

Mermaid Live Example Diagram

Notice how the decision has two labelled paths and one returns back to repeat.

⌨ Step 2: Paste This Code

Show/Hide Mermaid Code
flowchart TD
    A([Start]) --> B[/Enter a number/]
    B --> C{Is number < 5?}
    C -- Yes --> D[Add 1 to number]
    D --> C
    C -- No --> E([End])
Checkpoint: Your diagram should show a loop returning to the decision box.

πŸ›  Assessment Practice Challenge – Booking Validation

Now design your own algorithm flow chart.Β 

Create a flowchart for a booking system that:

β€’ Asks for the user’s name
β€’ Asks what type of pet they have (cat or dog)
β€’ Repeats the question if the input is invalid
β€’ Assigns a price based on the pet type
β€’ Displays a confirmation message
β€’ Ends
Think carefully:
Where is the loop?
What controls it?
Where is the price set?
Are all decision paths labelled?