From: Pete Yandell Date: 2007-07-04T09:10:58+09:00 Subject: Re: Using a block to surround a string? Ivan Vega wrote: > around_string('mystring') {|b, a| b = 'before'; a = 'after';} You want: around_string('mystring') { ['before', 'after'] } > def around_string(string, &block) > b, a = yield > "#{b}#{string}#{a}" > end And you wnat: def around_string(string) b, a = yield "#{b}#{string}#{a}" end For a quick intro to blocks, see the five minute talk I gave on them last week: http://www.cogentconsulting.com.au/screencasts/index.html A block, however, seems like a terrible way of doing this. Have you considered using an options hash? around_string('mystring', :before => 'before', :after => 'after') def around_string(string, *options) "#{options[:before]}#{string}#{options[:after]}" end Pete Yandell http://notahat.com/