Switch
This function is a multi-branch selection function. It consists of an expression and multiple branches with return values. If the expression equals a branch value, the function outputs the corresponding return value.
【expression】is the expression whose result will be matched against each branch.
【pattern】is the branch, each representing a possible result of the expression. Each branch has a corresponding return value.
【result】is the return value. If the result of the expression matches a branch, the corresponding return value is output.
【default】is the default value. If the result does not match any branch, the function outputs the default value. If the default value is not provided, it returns an empty value.
For example, in the first example, {countries} references a column of data, and its output value could be thousands of country names. It is the expression in this function. "China" and "Chinese" are a branch and return value, respectively, indicating that if the output value of {countries} is "China", it returns "Chinese". "General English" is the default value, indicating that if the output value of {countries} does not match any branch, it returns "General English".