Closed oswaldobapvicjr closed 4 months ago
This PR adds a new function SWITCH, to avoid too many IFs in some situations. The function was inspired by Microsoft Excel.
SWITCH
IF
SWITCH(expression, value1, result1, [value2-N, result2-N, ...], [default]
SWITCH(1, 1, "Sunday", 2, "Monday", 3, "Tuesday")
SWITCH(2, 1, "Sunday", 2, "Monday", 3, "Tuesday")
SWITCH(4, 1, "Sunday", 2, "Monday", 3, "Tuesday", "No match")
Issues 0 New issues 0 Accepted issues
Measures 0 Security Hotspots No data about Coverage 0.0% Duplication on New Code
See analysis details on SonarCloud
Thank you very much!
This PR adds a new function
SWITCH
, to avoid too manyIF
s in some situations. The function was inspired by Microsoft Excel.Syntax
Examples
SWITCH(1, 1, "Sunday", 2, "Monday", 3, "Tuesday")
SWITCH(2, 1, "Sunday", 2, "Monday", 3, "Tuesday")
SWITCH(4, 1, "Sunday", 2, "Monday", 3, "Tuesday", "No match")