Otter
Snippets
Otter
Upstream Otter 1.0.1 Tested
Multi-Branch Conditional (If / Otherwise)
Evaluate multiple conditions sequentially with fallback branch handling.
Architecture & Runtime Preview
Otter 1.0.1Zero-dependency Otter 1.0.1 snippet (Control Flow). Copy the parameterized template or run the self-contained example.
- 1Category: Control Flow
- 2Attribution: Otter Core Language Spec (D2)
- 3Zero external pack dependencies — paste directly into any .ot file
Source Code (2 files)
if ${condition}
say "branch 1"
otherwise if ${otherCondition}
say "branch 2"
otherwise
say "fallback"
.
score is 85
grade is "unknown"
if score is at least 90
grade is "A"
say "Grade: A"
otherwise if score is at least 80
grade is "B"
say "Grade: B"
otherwise
grade is "C"
say "Grade: C"
.
if grade is not "B"
fail with "if-otherwise evaluation mismatch: expected B"
.
Installation & Usage
otter snippet inspect cf-if-otherwise
Copy template.ot directly into your .ot source file, or run example.ot with 'otter run example.ot'.