From: serialhex Date: 2011-08-10T04:11:05+09:00 Subject: Re: *WHY* does this not work? --0015176f07a831427204aa17536b Content-Type: text/plain; charset=ISO-8859-1 On Tue, Aug 9, 2011 at 3:05 PM, Darryl L. Pierce wrote: > On Wed, Aug 10, 2011 at 03:52:59AM +0900, serialhex wrote: > > ok, so code: > > > > str = 'foo' > > => "foo" > > str.each_char do |c| > > c = 'x' > > end > > => "foo" > > > > WHY does str == 'foo' still?? > > Because each_char is not destructive to the original string's value. It > moves through the string as an array of characters and then passes each > one _by value_ to the block supplied. So while you might be able to > locally alter the value for that character, you don't have access to the > original string itself in the block. so is there a way to do that? easily without jumping through hoops of fire?? > Sometimes it's your expectation that's wrong and not the library you're > using. ;) > true, oh how annoyingly true... :P hex -- my blog is cooler than yours: serialhex.github.com The wise man said: "Never argue with an idiot. They bring you down to their level and beat you with experience." > > Other than the fact Linux has a cool name, could someone explain why I > > should use Linux over BSD? > > No. That's it. The cool name, that is. We worked very hard on > creating a name that would appeal to the majority of people, and it > certainly paid off: thousands of people are using linux just to be able > to say "OS/2? Hah. I've got Linux. What a cool name". 386BSD made the > mistake of putting a lot of numbers and weird abbreviations into the > name, and is scaring away a lot of people just because it sounds too > technical. -- Linus Torvalds' follow-up to a question about Linux --0015176f07a831427204aa17536b--