Ruby - Variables and Data Types
Given a list of values
[1, nil, 3, nil, 5], which Ruby code correctly counts how many elements are nil?[1, nil, 3, nil, 5], which Ruby code correctly counts how many elements are nil?.count(nil), .select(&:nil?).length, and .filter { |v| v.nil? }.size all work.v.nil? is true and count them. All produce the same result.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions