Re: Syntax for OR
- Posted by DerekParnell (admin) Mar 04, 2015
- 1659 views
I'm sorry Lonny, but what isn't correct?
Erm, you state it below:
It is incorrect that if A = (B or C) ... is equivalent to if (A = B) or (A = C) then ...
However Jim, nobody actually said that those two fragments were identical. If somebody had said that, THEN one could say "you are incorrect" - but no one did say it. True, it might have been implied, but we do not KNOW that. It would still be an assumption on our part.
I feel that if there's an assumption, then when trying to address it, one should spell out what one assumes while offering a 'correction'.
From the context of the original post, I interpreted katsmeow's post to mean:
- if A = (B or C) ... is equivalent to if (A = B) or (A = C) then ...##
And I think that's a reasonable interpretation of katsmeow's words.
Yes, to preface one's correction with our interpretation of something is a good thing, I believe.
However, I'd formed a different impression of the context for that post. I am under the impression that the major point was concerning the use of parenthesis in order to avoid misunderstandings re operator precedence. The example that Kat gave, with parenthesis, demonstrated a perfectly correct (but arguably suboptimal - because of the use of literals) syntax. For instance, the example could have been generalized to something like ...
if seqConn[1] = (condition_A or condition_B) then ...
which is just fine.
So without that sort of context, it would be presumptuous to assume that Kat's code is "incorrect".
I would think OP's post provides enough context...
Well ... maybe not so much, seeing that you and I see different 'context' for the post.
if we knew what the code intended by the code.
After spending several minutes rereading this line, I still do not understand what it means.
Yep - my mistake. I left out a 'r'. I'm surprised you didn't pick that one.