SELECT.....CASE Question
Is there a symbol that can be used as an "OR" in the statement: "CASE %1100 OR %1000" or can only one value be placed as a condition for CASE?· Thank you in advance.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
D Faust
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
D Faust
Comments
Sid
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Yesterday is history, tomorrow is a mystery, and today is a gift.
That is why they call it the present.
Don't have VGA?
Newzed@aol.com
·
Is the difference signifcant/would a select...case command be better than a bunch of "IF variable = ?"? By a bunch I mean 3 or 4. Where can I find the amount of space that a command takes up?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
D Faust
Sid
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Yesterday is history, tomorrow is a mystery, and today is a gift.
That is why they call it the present.
Don't have VGA?
Newzed@aol.com
·
www.emesys.com/BS2pbasic25.htm
It can be efficient and certainly easier to read when written as SELECT CASE instead of IF THEN. One caveat. It is possible to put an expression in the SELECT (e.g. SELECT x - 48), but avoid doing so, particularly if there are several CASEs, because PBASIC will parse out multiple copies of the expression. It's better to write, say, x=x-48 : SELECT x : ...
The manual has lots of examples on how to construct the conditional. You can have things like,
CASE %1100, %1000
' ...
CASE 2 TO 7, >=%1101
' ...
CASE ELSE
' ...
The conditionals (as opposed to expressions) are tokenized quite efficiently.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
Also, thank you for answering my question so quickly.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
D Faust
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
D Faust