In Ruby, is there a way to use something like hash.each_with_index do |[k,v], i|? May 6, 2023 by Tarik In fact, yes! Use parentheses: h = {:a => 1, :b => 2.2} h.each_with_index do |(k, v), i| p k, v, i end