Switch constructor
Creates $switch
operator expression
branches
- An array of control branch object. Each branch is an instance of CasedefaultExpr
- Optional. The path to take if no branch case expression evaluates to true. Although optional, if default is unspecified and no branch case evaluates to true, $switch returns an error.
Implementation
Switch({required List<Case> branches, defaultExpr})
: super(
'switch',
AEObject({
'branches': AEList(branches),
if (defaultExpr != null) 'default': defaultExpr
}));