From: Fily Salas Date: 2011-11-25T01:24:06+09:00 Subject: Re: Understanding Ruby blocks "Jesús Gabriel y Galán" wrote in post #1033561: > On Thu, Nov 24, 2011 at 4:55 PM, Fily Salas > wrote: > This is quite straightforward: in this situation the use case is that > you want to ensure that something happens before and after the block > code. In this case, the File#open method opens the file, then calls > the block and then ensures that the file is closed, even in the face > of an exception within the block. So the main difference in this case is that by using block the file will be closed by itself and if I use the second method I would need to manually close it? "Sylvester Keil" >http://yehudakatz.com/2010/02/07/the-building-blocks-of-ruby/ Thanks for the link, I will read more about blocks. Thank you all very much! -- Posted via http://www.ruby-forum.com/.