How i execute a method variable numer of times

hi ruby

example i have this method:

def little_meth
puts “hi there\n”
end

and say i want to run this method run x number of times.

i make program that looks something this way:

do
little_meth
x times

i request what is this for ruby?

thanks

-noose

On Sun, Jun 27, 2010 at 11:48 PM, Noose Dinli
[email protected]wrote:

i make program that looks something this way:

Posted via http://www.ruby-forum.com/.

def little_meth
puts “hi there\n”
end

x = 10

either of these will work

x.times { little_meth }

x.times do
little_meth
end

thanks for you josh