Merge pull request #74 from Nondv/patch-5

[ruby][case] Add a note about ===
pull/80/head
Igor Chubin 5 years ago committed by GitHub
commit f7f987fd68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -31,3 +31,16 @@ when /food/
when /doe/
puts "#{str}, a female deer"
end
# Please note that `case` uses `===` operator to match values.
# The following are equivalent:
case x
when Integer then "I'm a number"
when String then "I'm a text"
end
if Integer === x
"I'm a number"
elsif String === x
"I'm a text"
end

Loading…
Cancel
Save