Some ruby code for those non-rubyists:
(1..100) do |i|
if i * 2 == 8 and i + 1 == 5
puts "foo"
elsif i + 3 == 9
puts "bar"
else
puts i
end
end
Not the solution, but all the syntax you'll need in there.