We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Ruby Enumerables: 'any', 'all', 'none', and 'find'
Ruby Enumerables: 'any', 'all', 'none', and 'find'
Sort by
recency
|
47 Discussions
|
Please Login in order to post a comment
I know my code is working, but I get this message:
There is no input for this challenge. Your code is tested by a hidden checker.
what should I do to fix this?
Check this one
def func_any(hash) hash.any? {|key, value| key.is_a?(Integer)} end
def func_all(hash) hash.all? {|key, value| value.is_a?(Integer) && value < 10} end
def func_none(hash) hash.none? {|key, value| value.nil?} end
def func_find(hash) hash.find do |key, value| (key.is_a?(Integer) && value.is_a?(Integer) && value < 20) || (key.is_a?(String) && value.is_a?(String) && value.start_with?('a')) end end