From: John-John Tedro Date: 2011-08-14T23:59:20+09:00 Subject: Re: Problem with Files --001485f645ba199ed204aa7864f3 Content-Type: text/plain; charset=ISO-8859-1 On Sun, Aug 14, 2011 at 4:55 PM, John-John Tedro wrote: > On Sun, Aug 14, 2011 at 4:37 PM, amir e. 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 --001485f645ba199ed204aa7864f3--