You can use the times method of the Integer class:
5.times do send_sms_to('xxx') end
or a for loop
for i in 1..5 do send_sms_to('xxx') end
or even upto / downto :
1.upto(5) { send_sms_to('xxx') }
Andrei Andrushkevich Apr 15 '11 at 2:30 p.m. 2011-04-15 14:30
source share