case-defined function
nounUK /keɪs dɪˈfaɪnd ˈfʌŋkʃən/
US /keɪs dɪˈfaɪnd ˈfʌŋkʃən/
A function that does different things depending on which case matches.
The program uses a case-defined function to pick the right greeting for each language.
OTHER MEANINGS
2. A function whose behavior is chosen by matching a value against a list of cases.
The case-defined function returned 'weekend' when given Saturday.
3. A routine written with a case expression instead of many if-else checks.
She rewrote the messy if-else chain as a clean case-defined function.
4. A function in functional programming that selects a result based on pattern cases.
The case-defined function handled each shape type with its own pattern.