Logo

Programming-Idioms

History of Idiom 52 > diff from v25 to v26

Edit summary for version 26 by steenslag:
[Ruby] include? does not work like this for Hashes

Version 25

2019-02-02, 03:29:37

Version 26

2019-07-03, 19:33:06

Idiom #52 Check if map contains value

Determine whether map m contains an entry with value v, for some key.

Illustration

Idiom #52 Check if map contains value

Determine whether map m contains an entry with value v, for some key.

Illustration
Extra Keywords
table dictionary hash
Extra Keywords
table dictionary hash
Code
m.include?(v)
Code
m.value?(v)
Doc URL
http://ruby-doc.org/core-2.2.3/Enumerable.html#method-i-include-3F
Doc URL
http://ruby-doc.org/core-2.6.3/Hash.html#method-i-value-3F