On Sun, Aug 14, 2011 at 4:55 PM, John-John Tedro
<johnjohn.tedro / gmail.com>wrote:

> On Sun, Aug 14, 2011 at 4:37 PM, amir e. <aef1370 / gmail.com> wrote:
>
>> Hi
>> I don't understand meaning of thing that , this code return :
>>
>> File.open("a.txt")do |i|
>>  puts i
>> end
>>
>> please explain me.
>> and please explain me what is the difference between that code and below
>> code :
>>
>> File.open("a.txt").each do |i|
>>  puts i
>> end
>>
>>
>> thanks
>>
>> --
>> Posted via http://www.ruby-forum.com/.
>>
>
>
>
Accidentally hit "Send".

The first form is when "open" is called with a block.
For File#open:
http://www.ruby-doc.org/core/classes/File.html#M000069

The second form utilizes the "each" method in the IO class.
http://www.ruby-doc.org/core/classes/IO.html

-- John-John Tedro