# Switch

Grammar — Switch (Actions) depending on value
FlagsSubFunctions | Action

Switch statements check a specified condition, and perform a single action set based on the result. For example: If you wanted to apply a behavior to any unit that enters a certain region, but you want to apply a different behavior depending on the type of unit that enters the region, you could set up a Switch statement in your trigger based on the *"Unit Type "*of the “Triggering Unit”. Individual cases could then be added to the switch statement for different Unit Types, each case with its own unique action set. The Default action set would fire if the result from the Switch statement did not match any of the cases.

# Arguments

  • anycompare — Value

Returns — void

#INITAUTOVAR(val,value)
#SUBFUNCS(cases)
#IFHAVESUBFUNCS(cases,else ){
    #SUBFUNCS(defaults)
}

Category: General / Conditional Statements

# Examples

— None found —