Shop OBEX P1 Docs P2 Docs Learn Events
if...elseif statements — Parallax Forums

if...elseif statements

mmorelandmmoreland Posts: 89
edited 2011-10-15 21:42 in General Discussion
How does one construct a series of IF...THEN...ELSEIF statements that have an address to a sub routine rather than a statement following the THEN using a BS2p, as in:

IF date => 12 AND date <= 151 THEN Spr_Nox
ELSEIF date => 152 AND date <= 193 THEN Sum_Sol
ELSEIF date => 194 AND date <= 333 THEN Fal_Nox
ELSEIF date => 334 AND date <= 365 THEN Win_Sol
ELSEIF date => 1 AND date <= 11 THEN Win_Sol
ENDIF

Comments

  • Tracy AllenTracy Allen Posts: 6,666
    edited 2011-10-15 11:39
    That particular task is best handled by SELECT CASE:
    SELECT date
       CASE 12 TO 151
           GOSUB Spr_Nox
       CASE 152 TO 193
           GOSUB Sum_Sol
       CASE 194 TO 333
           GOSUB Fal_Nox
       CASE 334 TO 365,  1 TO 11
           GOSUB Win_Sol
    ENDSELECT
    
  • mmorelandmmoreland Posts: 89
    edited 2011-10-15 21:42
    Thank you. That was an immense help, and I've gotten it to work.
Sign In or Register to comment.