language · language ·

If, else if, and else

if branches on a bool expression. Parentheses around the condition are optional, and each branch uses a block.

cpuelseiflanguagelogicyeho

Use if for a small number of ordered decisions. Use match when one value has several named shapes or cases.

if condition { ... }
else if condition { ... }
else { ... }

Status: stable

Complete if, else if, and else example

Use if for a small number of ordered decisions. Use match when one value has several named shapes or cases.

cpu · language · type checked

int coins = 20
if coins >= 15 { Console.Log("You can buy the shield") }
else { Console.Log("Collect more coins") }
project.mech
manifestVersion = "2"
package = "api.example.language__if_else"
version = "0.1.0"
languageEdition = "yeho-core-2026.1"

[app]
kind = "headless"
Notes and source

The condition must be bool.

Keep the most specific or highest-priority branch first.

yeho/parser_statements.cpp parseIfStatement; conformance control.boolean-conditions