Quick Ruby Tip: || vs or
Quick heads up on operator precedence:
If you want to assign a value to a variable depending on a boolean, use ||
not or
.
||
takes precendence over =
. or
does not.
Example:
a = false or true
puts a # => false
a = false || true
puts a # => true
I got stuck a few minutes today until I realized where the error was.
Hope this helps and you don’t fall in the same trap :)