There is a trick you can use to determine if a value is truthy or falsey.
A single bang operator, !, will negate the boolean value it is placed in front of. For example:
!true # => false
!false # => true
The double bang operator: A "double-bang operator" (!!) will return true or false based on whether a value is truthy or falsey to begin with. For example:
!!"hello" # => true
!!nil # => false
In Ruby there are three main boolean operators:
Single bang which represents not;
!
Double ampersand which represents and;
&&
Double pipe which represents or;
||
To check if two values are equal, we use the comparison operator represented with double equal signs
1 == 1 # => true
Operator
== # If the values of the two operands are equal, then the evaluation is true.
!= # If the values of the two operands are not equal, then the evaluation is true.
> # If the value of the left operand is greater than the value of the right operand, then the evaluation is true.
< # If the value of the left operand is less than the value of the right operand, then the evaluation is true.
>= # If the value of the left operand is greater than or equal to the right operand, then the evaluation is true.
<= # If the left operand is less than or equal to the value of the right operand, then the evaluation is true.