From: Jeff Wood Date: 2005-08-18T22:25:12+09:00 Subject: Re: Newbie question --------------020105080103080501080805 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Lothar Scholz wrote: >Hello len, > >l> Is there some difference in the code I'm not seeing or is one better >l> than the other: > >l> languages = ['English', 'German', 'Ruby'] > >l> languages.each do |lang| >l> puts 'I love ' + lang + '!' >l> puts 'Don\'t you?' >l> end > >l> languages.each { |lang| >l> puts 'I love ' + lang + '!' >l> puts "Don't you?"} > > >No both are the same, the one liner > >languages.each { |lang| puts "I love #{lang}!\nDon't you?" } > >is also doing the same and a little bit more rubyish > > > Both are acceptable, but it is common convention that you use {} for one-liners and use do end for multi-line blocks. j. --------------020105080103080501080805--