and in Java SE 14 switch expressions becomes a standard language feature. For example: int ndays = switch(month) { case JAN, MAR, MAY, JUL, AUG, OCT, DEC -> 31; case APR, JUN, SEP, NOV -> 30; case FEB -> { if (year % 400 == 0) yield 29; else if (year % 100 == 0) yield 28; else if (year % 4 == 0) yield 29; else yield 28; } }; Alternative uses Many languages evaluate expressions inside switch blocks at runtime, allowing a number of less obvious uses for the construction. This prohibits certain compiler optimizations, so is more common in dynamic and scripting languages where the enhanced flexibility is more important than the performance overhead. PHP For example, in PHP, a constant can be used as the "variable" to check against, and the first case statement which evaluates to that constant will be executed: switch (true) { case ($x == 'hello'): foo(); break; case ($z == 'howdy'): break; } switch (5) { case $x: break; case $y: break; } This feature is also useful for checking multiple variables against one value rather than one variable against many values. COBOL also supports this form (and others forms) in the EVALUATE statement. PL/I has an alternative form of the SELECT statement where the control expression is omitted altogether and the first WHEN that evaluates to true is executed. Ruby In Ruby, due to its handling of === equality, the statement can be used to test for variable’s class: case input when Array then puts 'input is an Array!' when Hash then puts 'input is a Hash!' end Ruby also returns a value that can be assigned to a variable, and doesn’t actually require the case to have any parameters (acting a bit like an else if statement): catfood = case when cat.age <= 1 junior when cat.age > 10 senior else normal end Assembler A switch statement in assembly language: switch: cmp ah, 00h je a cmp ah, 01h je b jmp swtend ; No cases match or "default" code here a: push ah mov al, 'a' mov ah, 0Eh mov bh, 00h int 10h pop ah jmp swtend ; Equivalent to "break" b: push ah mov al, 'b' mov ah, 0Eh mov bh, 00h int 10h pop ah jmp swtend ; Equivalent to "break" ... swtend: Python For Python 3.10.6, PEPs 634-636 were accepted, which added and keywords. Unlike