Logo

Programming-Idioms

History of Idiom 51 > diff from v30 to v31

Edit summary for version 31 by programming-idioms.org:
[Ruby] 3 ways => 3 impls : see new impls 1910 and 1911. +DemoURL

Version 30

2016-11-28, 22:32:37

Version 31

2016-11-28, 22:34:09

Idiom #51 Check if map contains key

Determine whether map m contains an entry for key k

Illustration

Idiom #51 Check if map contains key

Determine whether map m contains an entry for key k

Illustration
Extra Keywords
table dictionary hash
Extra Keywords
table dictionary hash
Code
m.include?(k)
m.key?(k)
m.has_key?(k)
Code
m.include?(k)
Doc URL
http://ruby-doc.org/core-2.2.3/Hash.html#method-i-include-3F
Doc URL
http://ruby-doc.org/core-2.2.3/Hash.html#method-i-include-3F
Demo URL
https://repl.it/E9q8/0