Don't use a for-loop, that's how you'd do it in language like C, in Ruby we have abstractions (or can build them if not present) like [Enumerable#any?][1]: receive_payment_on = config[:sections].any? do |section| if section[:applicants] section[:applicants][:sections].any? do |app_sec| app_sec[:employment] && app_sec[:employment][:receive_payment_on] end end end [1]: http://www.ruby-doc.org/core-2.0/Enumerable.html#method-i-any-3F