Created
June 30, 2013 01:23
-
-
Save tarynsauer/5893389 to your computer and use it in GitHub Desktop.
Count the numbers in an array between a given range
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
def count_between(array, lower_bound, upper_bound) | |
array.count { |i| upper_bound >= i && i >= lower_bound } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment