Shop OBEX P1 Docs P2 Docs Learn Events
Compound IF statement. — Parallax Forums

Compound IF statement.

SelfPropelledSelfPropelled Posts: 6
edited 2010-06-29 20:57 in General Discussion
How might I implement the following IF structure in SX/B?
The test is to determine if X is between A & B:

If (A <= X AND X <= B) THEN
FOO= 1
Else
FOO= 0
ENDIF

This worked well in a DAQ BASIC environment on a PC, but generates 'invalid number of parameters' error in SX/B.
Any pearls of wisdom are welcome.

Comments

  • BeanBean Posts: 8,129
    edited 2010-06-29 20:57
    IF A <= X THEN
    · IF X <= B THEN
    ··· FOO = 1
    ··ELSE
    ··· FOO = 0
    ··ENDIF
    ELSE
    · FOO = 0
    ENDIF

    ·

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Use BASIC on the Propeller with the speed of assembly language.
    PropBASIC thread http://forums.parallax.com/showthread.php?p=867134

    March 2010 Nuts and Volts article·http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/prop/col/nvp5.pdf
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    There are two rules in life:
    · 1) Never divulge all information
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    If you choose not to decide, you still have made a choice. [noparse][[/noparse]RUSH - Freewill]
Sign In or Register to comment.