Select & Try..Catch block syntax limitations

BlitzMax Forums/BlitzMax Programming/Select & Try..Catch block syntax limitations

plash(Posted 2009) [#1]



Azathoth(Posted 2009) [#2]
Works here, you have to remove the () after the catch and case


plash(Posted 2009) [#3]
Works here, you have to remove the () after the catch and case
I know that. Hence 'syntax limitations'.

Why allow the parentheses on a single argument to Case but not on multiples?


Azathoth(Posted 2009) [#4]
The parenthesis is being treated as an expression; (0)= 0, but (5, 10) is a syntax error.

Edit: Select/Case are keywords not function calls.


plash(Posted 2009) [#5]
Edit: Select/Case are keywords not function calls.
I understand that. The (0)=0 point is interesting..

Thats just my coding style, I don't like open ended keywords/functions, regardless if they return something.


TaskMaster(Posted 2009) [#6]
You can use parenthesis the way you tried, but like this:

Case (5),(10)

I don't know why you would want to though.


Philip7(Posted 2009) [#7]
I don't know why you would want to though.


I also prefer Select/Case above a elseif construction, it feels cleaner.
Why wouldn't you use it? Ofcource you're going to run into situations where a variable can have more than one value for which you want to execute the same code.


Brucey(Posted 2009) [#8]
I think he meant, "why would you want to use the parenthesis" in his example - since they don't do anything other than add clutter.
Different if you are using a complex expression instead, of course.


plash(Posted 2009) [#9]
Case (5),(10)
I don't know why you would want to though.
Why would anyone want to do it like that?
Like I said before.. I just prefer to use parentheses at the end of certain keywords.

I hadn't noticed the effect (0) had until it was noted, which pretty much declares this not even a feature in the syntax.


Azathoth(Posted 2009) [#10]
I understand that. The (0)=0 point is interesting..
How is it interesting? The parenthesis is just part of the expression, like (1+2) is the same as 1+2 which is evaluated at compile time to 3.

I usually use parentheses for function calls or expressions in which I need to change the operator precedence.


plash(Posted 2009) [#11]
How is it interesting? The parenthesis is just part of the expression, like (1+2) is the same as 1+2 which is evaluated at compile time to 3.
Something can't be interesting if I hadn't noticed it before posting?

I fully understand that using parentheses is solving an equation, and I knew that before, I just never noticed it in this case because it didn't seem to fit.