Logical Operators Flashcards
and
Called Logical AND operator. If both the operands are true then then condition becomes true.
ex.
(a and b) is true
or
Called Logical AND operator. If both the operands are true then then condition becomes true.
ex.
(a or b) is true
&&
Called Logical AND operator. If both the operands are non zero then then condition becomes true.
(a && b) is true
||
Called Logical OR Operator. If any of the two operands are non zero then then condition becomes true.
ex.
(a || b) is true
!
Called Logical NOT Operator. Use to reverses the logical state of its operand. If a condition is true then Logical NOT operator will make false.
ex.
!(a && b) is false
not
Called Logical NOT Operator. Use to reverses the logical state of its operand. If a condition is true then Logical NOT operator will make false.
ex.
not(a && b) is false
?:
Ternary operator
If Condition is true ? Then value X : Otherwise value Y
ex.
a = true ? ‘a’ : ‘b’ #=> “a”
..
Creates a range from start point to end point inclusive
ex.
1..10 Creates a range from 1 to 10 inclusive
…
Creates a range from start point to end point exclusive
1…10 Creates a range from 1 to 9