Shop OBEX P1 Docs P2 Docs Learn Events
OR in IF/THEN — Parallax Forums

OR in IF/THEN

NewzedNewzed Posts: 2,503
edited 2006-03-12 04:17 in BASIC Stamp
If I write:

if x = 1·OR x = 5·OR x = 9·OR x = 13.....................

Is there a limit to the number of ORs I can use?

Sid

Comments

  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2006-03-09 23:53
    I don'tknow how many OR's
    but if you want to check if X is 1,5,9,13,17 etc
    use
    if (X-1) mod 4 = 0

    regards peter
  • NewzedNewzed Posts: 2,503
    edited 2006-03-10 00:00
    That was just an example, Peter.· The actual numbers will be much different with no pattern at all.

    Sid
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2006-03-10 00:20
    In that case you may want to use the LOOKDOWN command.
    See PBASIC help.


    regards peter
  • Fe2o3FishFe2o3Fish Posts: 170
    edited 2006-03-12 04:17
    Peter said...
    I don'tknow how many OR's
    but if you want to check if X is 1,5,9,13,17 etc
    use
    if (X-1) mod 4 = 0

    regards peter
    ... or IF (x MOD 4) = 1 smile.gif No subtraction needed.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    -Rusty-
    --
    Rusty Haddock = KD4WLZ = rusty@fe2o3.lonestar.org
    **Out yonder in the Van Alstyne (TX) Metropolitan Area**
    Microsoft is to software what McDonalds is to gourmet cooking
Sign In or Register to comment.