hi Manju,

...
> var=STDIN.gets
> case var
> when 1
...

  there's a little problem here - #gets returns a String, not an
Integer, so your case conditions will never be met... you'll have to
convert the input to integers, or the conditions to strings for this to
work.

> after completing one task the user should get the list of items again to
> do one more task.

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

  i'm sure there are better ways of doing it, but here's what i came up
with while having my morning coffee:

#######

def do_math_stuff

  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
    do_math_stuff
  else
    puts "bye!"
  end

end

do_math_stuff

#######

  hth,

  - j

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