Registry Synced

Control Flow

122 words
1 min read

Control Flow

Control flow decides which lines run and how many times they run.

Branches

An if statement asks a yes/no question. Only the matching branch runs.
python
score = 7
if score >= 8:
    badge = "gold"
else:
    badge = "steady"
The condition is false, so badge becomes "steady".

Loops

A loop repeats a block. The safest reading habit is to track the loop variable and the state that changes.
python
total = 0
for n in [2, 4, 6]:
    total = total + n
The values of total are 2, 6, then 12.

Practice

For every loop, name:
  • What changes each pass.
  • What stays the same.
  • What condition stops the loop.
Document Outline
Table of Contents
System Normal // Awaiting Context

Intelligence Hub

Navigate the knowledge graph to generate context. The Hub adapts dynamically to surface backlinks, related notes, and metadata insights.