Flowchart guide
Every flowchart is a real program. AlgoLab validates its structure, then executes it one node at a time.
Nodes
| Node | Outputs | Behaviour |
|---|---|---|
| Start | next | Where execution begins. Exactly one per flowchart. |
| Input | next | Binds the problem's input values to variables. Created for you from the problem contract. |
| Assign | next | Stores the value of an expression in a variable (count) or an element (result[i]). |
| Decision | true / false | Evaluates a condition and follows exactly one branch. |
| While | body / exit | Repeats the body while the condition is true. The body must lead back to the While node. |
| Return | — | Ends execution and returns the expression as the answer. |
Expressions
Expressions use a small Python-like language. They are parsed by AlgoLab — never executed as JavaScript or Python.
+ - *Arithmetic. + also joins strings and arrays.
/True division (7 / 2 = 3.5)
// %Floor division and modulo, Python semantics (-7 // 2 = -4, -7 % 3 = 2)
== != < <= > >=Comparison. == compares arrays element by element.
and or notBoolean logic, short-circuiting (&&, ||, ! also accepted)
x in s, x not in sMembership in a string or array
xs[i], grid[r][c]Indexing; negative indexes count from the end
[1, 2, 3], []Array literals
true false nullLiterals (True / False / None also accepted)
len(x)Length of an array or string (length(x) also works)
append(xs, v)New array with v added at the end
slice(x, start, end?)Part of an array or string, like x[start:end]
array(n, fill?)New array of n copies of fill (default 0)
min(...), max(...)Smallest / largest of the arguments, or of one array
abs(n)Absolute value
str(x), int(x)Convert to text / integer
lower(s), upper(s)Change letter case
is_digit(s), is_letter(s)Character class checks
Rules worth knowing
- • Every output port must be connected, and every node must be reachable from Start.
- • A variable must be assigned on every path before it is used — the validator tells you which one is missing.
- • Arrays are copied on assignment: after
b = a, changing b[0] does not change a. - • Conditions must be true or false; numbers are not treated as booleans.
- • Runs stop after 200,000 steps or 2 seconds, so an infinite loop shows an error instead of freezing the page.
Keyboard
- Delete / Backspace — remove selected node or connection
- Ctrl+Z undo · Ctrl+Shift+Z / Ctrl+Y redo
- Ctrl+Enter run the selected example · F10 step forward