I could make them as a bunch of if-statements: "if number in range(1,19): “Low number”
But since there are five scenarios, I want to use Switch.
I save the user input number as an Int32
But how do I get the cases to accept a range of numbers instead of just one inputs number?
Probably the UserInputNumber variable could be an array instead of Int, but not sure how.
For context: see the attached screenshot of the simple sequence with 5 cases - but here each case only represents one number.
You can put the whole code in while loop it will take inputs till the if condition is met. If the if condition is met it will break the while loop. In this case if input value is 0 it will break the loop.
in assign activity using string variable and passing your number variable
If(number > 0 And number <=19, "Low number",
If(number > 19 And number <= 39, "Almost low number",
If(number > 39 And number <=59, "Medium number",
If(number > 59 And number <= 79, "Almost high number",
If(number > 79 And number <= 100, "High number", "Invalid Number")))))
Using elif would be the best way as switch cannot take an array
You can use switch like this
In expression use If(InputNumber<=19,"Low Number",If(InputNumber<=39,"Almost Low Number,If(InputNumber<=59,Medium Number",If(InputNumber<=79,"Almost High Number","High Number"))))