switch statement - TheBuzzSaw/KellyScript GitHub Wiki

Switch statements will use a structure closer to that of if-statements: they are one line unless you use braces.

No more break statements. The default behavior is breaking out of a block. Fallthrough is achieved through either comma-separates lists or 'jump' keyword.

switch (value)
{
    // One line style.
    case (7) DoSomething();
    
    // One new line indent style.
    case (8)
        DoSomethingElse();
    
    // Traditional brace block.
    case (9)
    {
        DoYetAnotherThing();
        ContemplateLife();
    }
    
    // Multiple values (traditional fallthrough cases).
    case (10, 14, 19)
    {
        ProcessDataTables();
        jump 9; // Goto the case block for the value 9.
    }
    
    // Value ranges (shorthand fallthrough cases).
    case (20 to 29) Believe();
    
    default
    {
        FixThings();
        Avast();
    }
}