Shop OBEX P1 Docs P2 Docs Learn Events
Does SX/B support IF x THEN y ? — Parallax Forums

Does SX/B support IF x THEN y ?

lcarrlcarr Posts: 2
edited 2005-12-07 19:35 in General Discussion
I now·SX/B supports:
if x THEN GOTO_LABEL
but
Does SX/B support the sentence:

if x THEN y ' where y is a sentence, for example: IF x > 5 THEN y = 1

Besides this, does it support bitwise operators in conditionals?

For example, using:
if x & 1·<> 0·THEN GOTO_LABEL ' gives an error

while the following works:
z = x & 1
if· z<>0 THEN GOTO_LABEL

Obviously what I wanted to do is something like the following:

IF x & 1 <> 0 THEN y = 1

·

Comments

  • BeanBean Posts: 8,129
    edited 2005-12-07 19:15
    You must put it on seperate lines, like this:

    IF x > 5 THEN
    · y=1
    ENDIF

    You can also use ELSE

    IF x > 5 THEN
    · y = 1
    ELSE
    · y=2
    ENDIF

    "IF x & 1 <> 0 THEN y = 1" can be done by testing bit 0 of x


    IF x.0 <> 0 THEN
    · y = 1
    ENDIF

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "SX-Video·Module" Now available from Parallax for only $28.95

    http://www.parallax.com/detail.asp?product_id=30012

    "SX-Video OSD module" Now available from Parallax for only·$49.95
    http://www.parallax.com/detail.asp?product_id=30015

    Product web site: www.sxvm.com

    Those that would give up freedom for security will have neither.


    Post Edited (Bean (Hitt Consulting)) : 12/7/2005 7:18:06 PM GMT
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-12-07 19:35
    Read this thread about multiconditional IF THEN statements.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·1+1=10
Sign In or Register to comment.