On Mon, Sep 27, 2004 at 02:01:05PM +0900, Mehr, Assaph (Assaph) wrote: > Notice however in your programs that the line: > data= data.upcase > In encrypt actually creates a local variable named data, overshadowing > the parameter data. I don't think that's strictly true - there's no shadowing going on. As far as I know, parameter 'data' already *is* a local variable, and you are just reassigning it. For example: def foo(data) 1.times do data = "x" end puts data end foo("hello") # prints "x" If the second instance of 'data' were really a new local variable, it would be local to the block and drop out of scope at the end of it, but it doesn't. However, the underlying point you make is clearly right: for data = data.upcase then afterwards, data is pointing to a new object, which is a copy of the original string but with characters uppercased. In fact, str.upcase is implemented internally as str.dup.upcase! [from string.c] static VALUE rb_str_upcase(str) VALUE str; { str = rb_str_dup(str); rb_str_upcase_bang(str); return str; } Regards, Brian.