```
true and false # => false
false and true # => false
true and true # => true
false and false # => false
true && false # => false
false && true # => false
true && true # => true
false && false # => false
x = true and false # => false
p x # => true !!!!!!!!!!
x = false and true # => false
p x # => false
x = true and true # => true
p x # => true
x = false and false # => false
p x # => false
x = true && false # => false
p x # => false
x = false && true # => false
p x # => false
x = true && true # => true
p x # => true
x = false && false # => false
p x # => false
```

https://docs.ruby-lang.org/ja/latest/doc/spec=2foperator.html

- and
- or

Has a lower priority than `=`

, so with `x = true and false`

- x = true
- true and false (results are discarded)

Will occur, and `x`

will not become` false`

.

- &&use
- x = (true and false)

Recommended Posts