There are multiple ways of getting ruby.
However, you can also use solutions like RVM or rbenv to manage multiple and/or more recent ruby versions at once easily. For more information, see the official documentation.
#method
on the object, for example "hello".method(:length)
. You obtain
a method
object which behaves like a Proc
which you
can pass to other functions.
They refer to equivalent as booleans. Boolean is a type which can only
take two values: true
and false
.
When we use the terms "truthy" and "falsy", we refer to the equivalent as a
boolean value that an expression will have, which is used by control flow statements like if
or while
and filtering methods like Enumerable#select
.
Only two values are falsy, meaning that they will be interpreted as false
: nil
and false
. Any other value, including 0
, will be truthy and be treated as true
.
The ||
operator returns the argument which is truthy. In this
case, "b" == "a"
evaluates to false, but "b" evaluates to true, so "b" is returned.
See also the "What does "truthy" and "falsy" means?" answer.