Skip to content

Instantly share code, notes, and snippets.

@tarynsauer
Created June 30, 2013 01:23
Show Gist options
  • Save tarynsauer/5893389 to your computer and use it in GitHub Desktop.
Save tarynsauer/5893389 to your computer and use it in GitHub Desktop.
Count the numbers in an array between a given range
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