1
0
mirror of https://github.com/adambard/learnxinyminutes-docs.git synced 2025-08-27 00:26:15 +02:00

Merge pull request #1909 from farisj/ruby-adds-combined-comparison

Adds combined comparison operator to Ruby
This commit is contained in:
Adam Bard
2015-10-31 18:30:36 +08:00

View File

@@ -77,6 +77,11 @@ false.class #=> FalseClass
2 <= 2 #=> true
2 >= 2 #=> true
# Combined comparison operator
1 <=> 10 #=> -1
10 <=> 1 #=> 1
1 <=> 1 #=> 0
# Logical operators
true && false #=> false
true || false #=> true