Structured Control Language is TIA's text language — Pascal with a hard-hat. When logic involves maths, loops or arrays, ladder turns to spaghetti and SCL stays clean. The fastest way to get it is to watch it run, one line at a time, with every variable laid bare. So let's do exactly that.
This little block scans an array of six readings, tracks the highest, and computes the average — a textbook SCL job. Press ⏭ Step to advance one line and watch the variables update in real time; the yellow highlight is the line about to run. ▶ Run animates the whole thing.
Notice the FOR i := 1 TO 6 loop runs the body six times — the program counter jumps back to the loop each pass. Try writing that in ladder and you'll see why anything iterative belongs in SCL. The # prefix marks a block-local (temp/static) variable; "Data" in quotes is a tag from a DB.
🔁 FOR / WHILE / REPEAT — real loops. Iterate arrays, build sums, search. The thing ladder physically cannot do cleanly.
🔀 IF / ELSIF / CASE — branching that reads like English. CASE on a step number is the backbone of a hand-written state machine.
🧮 Operators & functions — + - * / MOD, SQRT(), ABS(), comparisons. Maths that would be painful in LAD/FBD.
📦 #temp vs static vs "DB" — #x is local, a VAR in an FB persists, "Recipe".x is DB data. Same rules you met in Blocks & Reuse.
Which task screams "write me in SCL," not ladder?