From: sto.mar@... Date: 2012-10-05T04:20:22+09:00 Subject: Re: Calculation of heights Am 04.10.2012 19:26, schrieb Joao Silva: > > heights=Hash.new > a=[] > b=[] > r=0 > i=0 > > puts "calculation of heights" > while r!=2 - you should use more descriptive variable names > puts "enter name: " > a[i]=gets.chomp.to_s - gets.chomp is already a string - you can push a new element to an array with <<, so that you do not need an index i > 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 "" you do not need the empty string > end names = [] heights = [] puts "calculation of heights" answer = nil while answer != 'n' print 'Enter name: ' names << gets.chomp print 'Enter height: ' heights << gets.to_f print 'Again? [y/n] ' answer = gets.chomp puts end --