bob iteration 4 in Ruby.