Odin Notes and Examples
(top-level)

Control Flow

// Note, no parens around the condition.
if some_condition {
    // Note, `some_condition` must yield a bool.
    // Can use ! for "not".
    // Can use all the usual comparison operators:
    // ==, !=, <, <=, >, >=
    // Use && and || for "and" and "or".
    // Use parens as needed.
}

if some_cond_1 {
    //...
}
else if some_cond_2 {
    //...
}
else if some_cond_3 {
    //...
}
else {
    //...
}

// All looping in Odin uses `for`. Supports `break` and `continue`.
// Can label loops if you like (usually so that you can break out of
// an outer loop).

for {
    // loops forever unless you `break`
}

// Instead of "while some_cond {...}", use "for some_cond {...}",
// for example:
i := 0
for i < 10 {
    fmt.println(i)
    i += 1
}

// a more compact way to write that
for i := 0; i < 10; i += 1 {
    // note the semicolons above
}

// and the customary way:
for i in 0..<10 {
    // That "0..<10" is a "range".
    //      "4..=12" works too.
}