mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-08-21 05:51:31 +02:00
Adds combined comparison operator to Ruby
This commit is contained in:
@@ -77,6 +77,11 @@ false.class #=> FalseClass
|
|||||||
2 <= 2 #=> true
|
2 <= 2 #=> true
|
||||||
2 >= 2 #=> true
|
2 >= 2 #=> true
|
||||||
|
|
||||||
|
# Combined comparison operator
|
||||||
|
1 <=> 10 #=> -1
|
||||||
|
10 <=> 1 #=> 1
|
||||||
|
1 <=> 1 #=> 0
|
||||||
|
|
||||||
# Logical operators
|
# Logical operators
|
||||||
true && false #=> false
|
true && false #=> false
|
||||||
true || false #=> true
|
true || false #=> true
|
||||||
|
Reference in New Issue
Block a user