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

···

--
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

···

On Sun, Jun 27, 2010 at 11:48 PM, Noose Dinli <unter_noob@yahoo.com.au>wrote:

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
--
Posted via http://www.ruby-forum.com/.

thanks for you josh

···

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