Last active
May 6, 2020 16:24
-
-
Save whiz25/d8275b72f3ff965cd8d5b81d9c70ca71 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- [ ] should be identical and returns the same thing as ruby's [`count`](https://ruby-doc.org/core-2.6.4/Enumerable.html#method-i-count). ([Screenshot](https://gitlab.com/microverse/guides/projects/requirements_screenshots/raw/master/images/ruby/advanced_building_blocks_enumerable/my_count.png) from [Odin](https://www.theodinproject.com/courses/ruby-programming/lessons/advanced-building-blocks#assignment-2)) | |
- [ ] returns the number of items in enum through enumeration | |
```ruby | |
array = Array.new(100){rand(0...9)} | |
array.my_count == array.count # should return true | |
``` | |
- [ ] counts the number of items in enum that are equal to item if an argument is given | |
```ruby | |
array.my_count(0) == array.count(0) # should return true | |
``` | |
- [ ] counts the number of elements yielding a true value if a block is given | |
```ruby | |
array.my_count(&block) == array.count(&block) # should return true | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment