Shop OBEX P1 Docs P2 Docs Learn Events
quick spin question — Parallax Forums

quick spin question

dr hydradr hydra Posts: 212
edited 2012-02-29 13:25 in Propeller 1
I am looking at code by Bob Belleville from the object exchange for use with IR input/output...the file name is ir_oscope.spin

My question relates to the line "if INA[irpin]" is that the same as "if INA[irpin] == 1"? It looks like comparsion value is missing in the orginal code...

Comments

  • MagIO2MagIO2 Posts: 2,243
    edited 2012-02-29 13:25
    In this case yes!

    INA[ irpin ] is a single bit, so it can only have values 1 or 0. But you can also see such an if-statement with other datatypes (byte, word or long):
    if myByteVar
    ' do this
    In fact the value has to be 0 to be false. Each other value will be seen as true by the if.
Sign In or Register to comment.