On Wed, Nov 21, 2012 at 11:36 PM, Ferdous ara <[email protected]> wrote:
> Hi, my question might be confusing as its hard for me to make it clear,
Chances are that if you understand what you want the solution will
come much easier. :-)
> what i want is , something like bellow
>
> $i = 1
> $num = linecount.to_i + 1
> #$faulty_count = 0
> while $i < $num do
> current-#{i} = current_result["#{server_name}-#$i"]["usable"]
>
> puts current-#{i} --------------
> $i +=1
> end
> Basically ,
> i want to store value of current_result["#{servername}-#$i"]["usable"]
> in to a variable (incremental variable )
As others have said: store in an Array. I don't know what
current_result refers to but it looks like something like this could
work:
current_first = linecount.times.map {|i|
current_result["#{server_name}-#{i + 1}"]["usable"]}
> So after this, i wanted to do like this
>
> current-#{i} == current-#{j}
Assuming we have current_first and current_second then you could just do
current_first == current_second
Kind regards
robert
--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/
-- You received this message because you are subscribed to the Google Groups
ruby-talk-google group. To post to this group, send email to
[email protected]. To unsubscribe from this group, send email
to [email protected]. For more options, visit this
group at https://groups.google.com/d/forum/ruby-talk-google?hl=en