Page 1 of 1
[Implemented] case select with multiple options
Posted: Fri Oct 03, 2003 3:38 pm
by blueznl
(from the beginners forum)
currently, every case can only have 1 expression
select a
case 1
case 2
case 3
endselect
is it possible to get more expressions per case?
select a
case 1 , 2
case 3
endselect
it beats a long list of if / elseif / elseif / endif...
Posted: Fri Oct 03, 2003 6:54 pm
by Psychophanta
Yeeeeah!, that is a good request, because sometimes is very needed.
And not just only things like "Case 3,4,5,6" but also like "Case 2 To 29" would be fine, fine, fine.
AL
Posted: Fri Oct 03, 2003 6:57 pm
by blueznl
you mean fine to fine?

Posted: Fri Oct 03, 2003 7:01 pm
by Psychophanta
Yeah!
and nice to nice
But Fred is surely thinking in other matters.

Re: case select with multiple options
Posted: Sun Oct 05, 2003 10:36 am
by PB
> is it possible to get more expressions per case?
> it beats a long list of if / elseif / elseif / endif...
Actually, If/ElseIf uses less code than Case:
Code: Select all
Select a
Case 1,2 If a=1 Or a=2
Debug "1 or 2" Debug "1 or 2"
Case 3 ElseIf a=3
Debug "3" Debug "3"
Case 4 To 10 ElseIf a>3 And a<11
Debug "4 to 10" Debug "4 to 10"
EndSelect EndIf
Case = 113 bytes. If/EndIf = 103 bytes.

Posted: Sun Oct 05, 2003 12:17 pm
by blueznl
readability, you... you... you... goto lover!

Posted: Sun Oct 05, 2003 12:31 pm
by Fred
The fact is than: Case 1,2 or Case 1 to 10 doens't work actually ! A check has been added for the new version (that's why it's shorter here too)
Posted: Mon Oct 06, 2003 9:09 am
by PB
> readability, you... you... you... goto lover!
LOL!

Posted: Mon Oct 06, 2003 10:20 am
by blueznl
it was the best insult i could come up with
