Trek chapter opener illustration

Trek

LOOP / ITERATION — *keeps going around until the work is done.*

Chapter 3 — Trek and the Circular Track

Trek is NOT an animal-tween. Trek is a deliberately abstract concrete-object-figurea small painted circular-track figure with arrows showing repetition + a small counter showing the iteration count. The track loopsthe figure shows code going around again and again until a stopping condition is met.

This is load-bearing. Trek embodies the loop / iteration primitive — running the same block of code repeatedly. Three common loop types:

  • for loops: run N times, where N is known. for i in 1...10.
  • while loops: run until a condition becomes false. while x > 0.
  • for-each loops: run once for each item in a collection. for item in list.

Loop teaches (on Trek’s behalf):

  • Loops avoid copy-paste. (Don’t write the same code 10 times; loop it.)
  • Need a STOPPING CONDITION. (Without it, infinite loop. Important!)
  • Counter variables track iteration.
  • Break + continue control loop flow. (break: exit early; continue: skip to next iteration.)
  • Nested loops: loops inside loops. (Beware: complexity grows multiplicatively.)
  • Recursion is a related concept. (Function calling itself — Coil-style. Loops can usually be rewritten as recursion + vice versa.)

Loop, on Trek’s behalf: “Trek is the loop. Repeat the work until done. Stopping condition required. Not a runner; a repeater.

“Not hard. Repeat with stopping condition.”


Voice register

Silent (Loop speaks). Concrete-object circular-track figure.

Sample lines (Loop):

  • “Keep going around until the work is done.”
  • “Stopping condition required.”

Arc

  • Kit 3 — Anchor.
  • Kits 4-16 — Recurring.

Relationships

  • Alliance: All CodeRealm cast. Cross-app: DiscreteQuest Coil (recursion + iteration are related).

Cultural-sensitivity gate

LOAD-BEARING anti-tech-genius-hagiography gate.

Cultural-context note

Loops foundational to all imperative programming. for/while/for-each variants standard across languages.

The CodeRealm ensemble

Trek is part of CodeRealm's distributed-narrative cast. Each character embodies a different curricular primitive; together they teach the full subject.