CASE WHEN condition1 THEN result1 WHEN condition2 THEN result2 ... ELSE result END 其中,condition1、condition2等是条件表达式,result1、result2等是对应条件的结果。ELSE子句是可选的,用于指定当所有条件都不满足时的默认结果。 如果要在CASE表达式中使用IF语句,可以将IF语句作为条件表达式。例如,假设有一...
The main difference is that switch despatches immediately to the case concerned, typically via an indexed jump, rather than having to evaluate all the conditions that would be required in an if-else chain, which means that code at the end of the chain is reached more slowly than code at t...