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 `<main>'

>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/.