wish lists etc
- Posted by David Cuny <HW1.DCUNY at HW1.CAHWNET.GOV> Jan 03, 1997
- 1491 views
*** Reply to note of 01/02/97 20:35 re: why do i want a case statement. as with most things, the CASE statement can be done with the classic if/else/endif. however, the QBASIC (not C!) version is a little bit different from what you might have in mind. it takes the form: SELECT CASE <expression> CASE <test>... CASE <test>... CASE ELSE... END SELECT where the test is the *right hand side* of the expression. it's just a shorthand, so you can write: SELECT CASE foo CASE 1 TO 10 ... CASE 11,13,17 ... CASE > 20 ... CASE ELSE END SELECT but yes, you can get the same results with an if clause. the CASE just gives a shorthand (lazier) way to write. i find: CASE 1 to 10 easier to read than: elsif foo >= 1 and foo <= 10 ... although they amount to the same thing. -- david cuny