Skip to content

Commit 058bc63

Browse files
author
Bozhidar Batsov
committed
fixed #71 - clarify Set usage advice
1 parent d348321 commit 058bc63

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,6 @@ in *Ruby* now, not in *Python*.
791791

792792
## Collections
793793

794-
* It's ok to use arrays as sets for a small number of elements.
795794
* Prefer `%w` to the literal array syntax when you need an array of
796795
strings.
797796

@@ -810,7 +809,10 @@ strings.
810809
arr[100] = 1 # now you have an array with lots of nils
811810
```
812811

813-
* Use `Set` instead of `Array` when dealing with lots of elements.
812+
* Use `Set` instead of `Array` when dealing with unique elements. `Set`
813+
implements a collection of unordered values with no duplicates. This
814+
is a hybrid of `Array`'s intuitive inter-operation facilities and
815+
`Hash`'s fast lookup.
814816
* Use symbols instead of strings as hash keys.
815817

816818
```Ruby

0 commit comments

Comments
 (0)