From: Hans Mackowiak Date: 2013-03-11T21:43:59+09:00 Subject: Re: Confusion with block local variable declaration with block variable declaration within the pipe maybe the newstr was defined in the paragraph before, or there is a failure in the book Thanks for your help! >>> a="" >=> "" >>> a << " ".capitalize! >TypeError: can't convert nil into String > from (irb):2 > from C:/Ruby193/bin/irb:12:in `
' >Got the above one. did you finally understand the difference between capitalize and capitalize! and why this works: newstr ="" a = "hello world".split(//).each{ |x| newstr << x.capitalize } but this does not? newstr ="" a = "hello world".split(//).each{ |x| newstr << x.capitalize! } ?? -- Posted via http://www.ruby-forum.com/.