Logo

Programming-Idioms

History of Idiom 170 > diff from v4 to v5

Edit summary for version 5 by steenslag:
New Ruby implementation by user [steenslag]

Version 4

2018-04-08, 07:21:23

Version 5

2018-04-08, 19:45:52

Idiom #170 Get map size

Set n to the number of elements stored in mymap.

This is not always equal to the map capacity.

Idiom #170 Get map size

Set n to the number of elements stored in mymap.

This is not always equal to the map capacity.

Code
n = mymap.size
Doc URL
https://docs.ruby-lang.org/en/2.5.0/Hash.html#method-i-size