And vs. &&
Give the following a try to process the difference:
a = 'this' && 'that'
b = 'those' and 'these'
p a
p b
&&
obtains the second of the values('that'
)
and
obtains the first ('these'
), thanks to operator precedence.
rubocop
prefers we use &&
.
Excellent explanation from Avdi Grimm.
Written by Melanie Archer
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Related Tags
#ruby
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#