Was wondering if PBP will allow this?
if x = 1 OR 2 then do this
It compiled fine, but wasn't sure if you could have an OR statement on the condition side.
Tony
Was wondering if PBP will allow this?
if x = 1 OR 2 then do this
It compiled fine, but wasn't sure if you could have an OR statement on the condition side.
Tony
I would think it should be IF X=1 OR X=2 THEN....
"If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte
The PBP help file for the AND statement says.....
Be sure to use parenthesis to tell PICBasic the exact order you want the operations to be performed.....
That means your original statement should look like.....
IF (X=1) OR (X=2) THEN....
HTH
BrianT
Thanks guys for the help. Sometimes, the answer is right in front of you, but you're so stuck on seeing it the other way, that your mind doesn't realize it. The way I wrote it sounded so logical, but I know the chip isn't that smart, hence, why we have to tell it EXACTLY what to do or else it won't do it.
Before I could get an answer, I rewrote it into separate IF statements. Seems to flow that way too. Thanks again.
Tony
Bookmarks