From: Josh Huber Date: 2001-04-21T06:55:47+09:00 Subject: [ruby-talk:13943] Re: number to string to number Robert Najlis writes: > I added instances of the class Adapt. I pushed the number zero onto > the times Used array > > @adaptations[@lastQueryNum].timesUsed.push(0) OK...so far... > @adaptations[@lastQueryNum].timesUsed[count] > ="#{@adaptations[@lastQueryNum].timesUsed[count]}".to_i + 1 You really don't need to do this... > perhaps I could have skipped the casting it to string, as the type > was already string for @adaptations[@lastQueryNum].timesUsed[count]. ^^^^^^ huh? it doesn't look like a string to me... foo = [] foo.push(0) foo[0] += 1 p foo output: [1] I'm confused. Why do you think you're operating on a string? Even if it is a string, this looks like a quick way to get what you want: foo = [] foo.push("0") foo[0].succ! p foo output: ["1"] So, for your variables, you would want: @adaptations[@lastQueryNum].timesUsed[count] += 1 and that's it. unless I'm missing something. -- Josh Huber