-->
Page 3 of 3

Re: switch / case statements

PostPosted: Thu Sep 15, 2016 6:15 am
by Oldbod
I think this is brilliant and just what i was looking for in another language. Is there any error handling for it? I think i feel a feature request coming on....

Re: switch / case statements

PostPosted: Thu Sep 15, 2016 6:19 am
by Ecoli-557
Triple-kewl!

Re: switch / case statements

PostPosted: Fri Sep 16, 2016 2:03 am
by livetv
Thanks! That is what I had in mind. Does this work with expressions as well?

ex: gosub word("[Option1] [Option2] [Option3]", option)

I'll go and find out anyway but wanted to plant that notion in case not.

Re: switch / case statements

PostPosted: Fri Sep 16, 2016 8:00 am
by bugs
That does work:-
Code: Select all
for option = -1 to 4
 gosub word("[Option1] [Option2] [Option3]", option)
 next option
end

[Option1]
print "option1"
return

[Option2]
print "option2"
return

[Option3]
print "option3"
return


and it catches the deliberate boundary errors too!

Error at line 4: Gosub Label not found:
Error at line 4: Gosub Label not found:
option1
option2
option3
Error at line 4: Gosub Label not found:
Done...

:D