From: jake kaiden Date: 2011-11-26T04:46:42+09:00 Subject: Re: Understanding Ruby blocks hi Fily, the File.open block is really useful, but probably not the easiest way to understand how to use blocks... think about the Array.each block - when you call Array.each, you then define a block of code that will be passed each entry in the array as an argument (which you name inside the bars ||) array = ["Tom", "Dick", "Harry"] array.each do |name| puts "Hi " + name end => Hi Tom Hi Dick Hi Harry ...or... array.each do |name| puts "Hi " + name unless name == "Dick" end => Hi Tom Hi Harry note that you can usually also use curly braces {} instead of the 'do' and 'end' keywords... array.each{|name|puts "Hi " + name} hth - j -- Posted via http://www.ruby-forum.com/.