From: ts Date: 2002-11-14T01:58:09+09:00 Subject: Re: Newbie Question. >>>>> "m" == montana writes: m> 3.times {|i| puts i} Well, the method Integer#times iterate self times (3 in your case) and for each iteration call the block, given it the current value. This method can be written (very badly) class Fixnum def times i = 0 while i < self yield i i += 1 end end end m> something do |line| m> #process something and line here m> end m> Is this correct? You take some object named something and process it's m> values in the do-end statement using the variable list?? not really, `something' is a method and this method call the block with some value. For example if you want to read a file, you write IO.foreach('file') do |line| # do something with line end the method IO::foreach open the file given in argument, read each line and call the block, given it the current line. At the end, IO::foreach close the file m> But yield calls the block to do some value manipulation? yield call the block with some values, and the block make some computation with these values Guy Decoux