Core Syntaxif, for, and switch (The Only Loop)
All courses

Go keeps loops simple

for is the only loop — classic three-clause, while-style, and range all use for.

if can include a short statement: if n := len(s); n > 0 { }. switch does not fall through by default (no accidental C-style bugs).

Output
Press Run to execute your code.