3 ms·
This does not respond to the issue raised in the article. In all of jlongster's examples, the result of the '&&' operator is being used. So, someone reading th
by psyklic 16y ago
This does not respond to the issue raised in the article.
In all of jlongster's examples, the result of the '&&' operator is being used. So, someone reading the code can mentally consider the '&&'s to be logical operators.
However, in the article's examples, the result was not being used at all. So, the '&&' was being used not as a 'logical operator' but as a 'conditional operator', which is a non-intuitive use.
Also, '&&' and '||' are not Boolean operators -- they are logical operators, where order matters for short-circuiting.
- teej 16y agoFor what it's worth, I've often seen code like jlongster's example, but never seen code like the OP's example.
- aaronblohowiak 16y agousing && as a conditional operator is a common rubyism
- silvestrov 16y agoIn the first 2 examples the result of the && operator isn't used.