Re: Syntax for OR
- Posted by katsmeow Mar 04, 2015
- 1656 views
How do we know test what he intended?, he didn't use parenthesis!
Good point. The OP - using a gender-neutral name - did not say which test was intended:
It seems that this syntax is supported ?
if seqConn[1] = 1 or 3 then
Or
and is equivalent to..
if seqConn[1] = 1 or seqConn[1] = 3 then
casey
If I had to guess though, I'd go with the second one. It seems very unlikely that the first test would ever be intended, since it is always true (and not in a place like a loop where one might want an always true test to perform an infinite loop).
I wasn't going to guess. The specified '1' and '3' may have been easier to type for this illustration than the actual numerals in the actual code. I knew when i posted the first time that '(1 or 3)' could be reduced, but the secondary point i was making is next year the OP may not realise what his code was doing, and may be guessing as much as we were. Parentheses eliminate much of the arbitrary, and are second to comments to explain the intended program flow.
Kat,
guessing jimcbrown will feel compelled to post a response.