All Downloads are FREE. Search and download functionalities are using the official Maven repository.

reference.language.switch.html Maven / Gradle / Ivy




    
    Switch
    
    

    
    

    
    

    
    
    
    

    


Switch statements

A switch statement is a way to change the flow of execution based on a variable value.
A switch statement has the form switch on a followed by one or more when value statements where a is an expression, value is an expression compatible with a, and statements is a list of statements which will be executed whenever a matches value.

Once the value is matched, and the corresponding statements are exectued, the flow of execution resumes at the end of the switch statement.


Optionally, a switch statement can end with an otherwise clause and list of statements, which will be executed when no previous value matches. The otherwise clause must be after all the when clauses.



Matching lists of values

Switch statements support matching list of values using when in values where values must be a collection.



Note: in Objy dialect, Prompto uses the switch, case and default keywords like in C++, Java and C#.




© 2015 - 2025 Weber Informatics LLC | Privacy Policy