Ruby/Statement/step
Материал из Wiki.crossplatform.ru
Версия от 18:00, 13 сентября 2010; ViGOur (Обсуждение | вклад)
add the even numbers from 4 to 12
puts "What"s the answer?" sum = 0 4.step(12, 2) do |even_value| sum += even_value end puts "The answer is " + sum.to_s