Menu
Samaritan's Purse

SWITCH

switch executes code when a condition matches a case.

Break ends the code.

Default executes when no case is a match.

SYNTAX

switch (condition) {
    case 1:
        code
        break;
    case 2:
        code
        break;
    ...
    default:
        code
}

EXAMPLES

INTERNAL

else

else if

if

try catch

EXTERNAL

Mozilla Developer Network