In my code I found recently an innocent looking bug of this type:
x=1
y=2
if x < 3 & y < 6
... do important stuff ...
end
What I meant to check in the if
condition was of course
(x < 3) & (y < 6)
## or
x < 3 && y < 6
My current take-way is that I should never use &
but always &&
except I really want know what I’m doing (i.e. fiddling with low-level stuff). Is this reasoning correct or did I miss a subtle point?
PS: Maybe it we should emphasize this difference more in the Noteworthy differences from R section