select and case
BlitzMax Forums/BlitzMax Beginners Area/select and case
| ||
can some one tell me the syntax for select case where I want to lump in a load of values together. I thought it was select var case 1..10 end select to select all values between 1 and 10 is var was an int. ?? |
| ||
You can have a list separated by commas. Case 7,8,9 This matches 7,8 or 9. That would be a little tedious for larger ranges. There is always this old trick for more complex situations: x = 17 Select True Case x < 15 Print "below 15" Case 15 <= x And x <= 18 Print "15 to 18" Case x > 18 Print "above 18" End SelectEach Case is an expression which can be True or False. Last edited 2011 |
| ||
yeah gona need to use that, I was sure you could use case 1..10 but I might be confusing blitz with something else like c or pascal. thanks m8 I had forgotten all about select true. |
| ||
Thanks Floyd I didn't know that Case 7,8,9 syntax. A select case statement can always be represented by an equivalent chain of if statements. |