BooleanOperators: &&


#1

How does this return a true value? true && 100>=100
Would true>=100 be true as well?

I am not sure of how "true" can be accounted for in a numerical expression.

Thank you for your help!


#2

true is a Boolean primitive; naturally, always true. 100 >= 100 is a Boolean expression, which in this instance yields true.

    true && true

is always true.


#3

Oh! I see. I was reading it as:
true is greater than or equal to 100
AND
100 is greater than or equal to 100.

Thank you for your answer :relaxed:


#4

It's important to note order of operations in expressions.

    true && 100     # true

but, the comparison expression takes precedence to the logical one, so,

    100 >= 100

is evaluated first, which then leaves,

    true && true