Hi All

The question I have is how to load a hash where the key is not numeric
or does not follow a cycle. I'm doing an exercise where I have to go
asking people's names and their corresponding heights, these the income
each in a different array, and then deposit them into a hash and get
over 2 meters, 1.60 meters minors, etc. The problem is how to charge the
hash data arrays. Here is the code:

##############################################################

heights=Hash.new
a=[]
b=[]
r=0
i=0

puts "calculation of heights"
while r!=2
  puts "enter name: "
  a[i]=gets.chomp.to_s
  puts "enter height: "
  b[i]=gets.chomp.to_f
  i=i+1
  puts "want to perform other income: 1-> yes, 2-> no: "
  r=gets.chomp.to_i
  puts ""
end

for i in 1..a.length
  for j in 1..b..length
    alturas[i]=a[i]
    alturas[j]=b[i]
  end
end

######################################################################

is not applicable in Ruby using for loops, but not the only language I
use then I get a little tricky to get used.

not if you understand the problem.

Thanks.

-- 
Posted via http://www.ruby-forum.com/.