Hello, I am having trouble understanding booleans and comparators. I can't quite grasp how they work and what && and || etc means. Can anyone explain to me what these are simply? Thanks.

# Don't Understand Booleans and Comparators "Control Flow in Ruby"

**zeroclifawn**#2

Comparators are used to compare different items.

|| is the OR operator.

It will return TRUE if one or both sides of the equation are true.

Example:

true || true => will log true since at least one side is true

true || false => will log true since at least one side is true

false || true => will log true since at least one side is true

false || false => will log false since neither side is true

&& is the AND Operator. It works just like the OR operator except that both sides must be true instead of just one side.

!= is the NOT operator. It makes true statements false and false statements true.

!true ==> becomes False

!false ==> becomes True

I find the best way to figure these things out is just to play around with them in doe for a while.

Make up examples of each until you get them.