hi again,

>   you could define the whole thing in a method, and recall that method
> unless "4" is returned from #gets.

  you could also skip the method, and just put the whole thing in a 
`while` loop...

#######

var = 0
while var != 4

  puts "enter two numbers separated by a comma:"

  nums = gets.chomp!.split(",")
  a = nums[0].to_i
  b = nums[1].to_i

  puts "\tpress 1 for adding
  press 2 for subtraction
  press 3 for multiplication
  press 4 to exit"

  var = gets.chomp!.to_i

  case var
  when 1
  result = a + b
  when 2
  result = a - b
  when 3
  result = a * b
  else
  result = "wrong entry" unless var == 4
  end

  unless var == 4
    puts "result => #{result}"
    puts
  else
    puts "bye!"
  end

end

#######

 - j

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