"&&" as control flow operators
Recently, despite having zero knowledge of Ruby, I read a Ruby article on and
vs &&
, via Ruby Inside. It's pretty interesting to note such a distinction in Ruby.
Let's have a look at python and JavaScript.
For python: the C-like &&
is not available, only and
. Using the Python interpreter:
>>> print 1 and "foo"
foo
For JavaScript: the Perl-like and
is not available, only &&
. Using Chrome's console:
> console.log(1 && "foo")
foo
undefined
So it seems flow control is the name of the game in them both.