> Thats works but only in block scope, how can i define 5 vars in global
> scope(with ability to access it out of block)?
you ... probably don't want to. having to dynamically generate your
variable names is generally a sign that either you're using foreign data
for them, or they're closely related. or both.
in the former case, doing that would be unsafe, and you should probably
use some sort of array (or a hash). the latter case ... you should also
probably do that.
> On 02/07/2012 05:59 PM, Eilie wrote:
>> Hello, everyone.
>> Subj on 1.9.3.
>> I tryed already:
>> 5.times {|n| eval "house#{n} = Array.new(5)"}
>> Thats works but only in block scope, how can i define 5 vars in global
>> scope(with ability to access it out of block)?
> you ... probably don't want to. having to dynamically generate your
> variable names is generally a sign that either you're using foreign data
> for them, or they're closely related. or both.
> in the former case, doing that would be unsafe, and you should probably
> use some sort of array (or a hash). the latter case ... you should also
> probably do that.
Yeah, you're right. Hash better choice for that, sorry for disturbance.
On Wednesday, February 8, 2012 3:41:45 AM UTC+1, Eilie wrote:
> On 2012-02-07, sreservoir <sreserv...@gmail.com> wrote:
> > On 02/07/2012 05:59 PM, Eilie wrote:
> >> I tryed already:
> >> 5.times {|n| eval "house#{n} = Array.new(5)"}
> Yeah, you're right. Hash better choice for that, sorry for disturbance.
Why not an Array? You are indexing by integer anyway.
Assuming you really want five Arrays of length five each: