There way to do it has been answered. The two main problems that I see here are: *Problem 1* `Input1(new)` ...to create a new `Input1` object, you should call `Input1.new` (i.e. call the new method on the Input1 class) *Problem 2* the `gets` method is returning a string, so you need to cast the variables to integers somewhere (using .to_i) this can be in the class, or on gets (i.e. `gets.to_i`) On Sun, Aug 3, 2014 at 9:13 PM, Marc Chanliau <marc.chanliau / gmail.com> wrote: > I'm learning to write Ruby using classes (as opposed to scripts). > I can't get the following (extremely simple) class to run (although I > get the corresponding script right). What do I need to do to fix it? > > Here is the class: > > class Input1 > > def initialize(n1, n2) > @n1 = n1 > @n2 = n2 > end > > def sum > @n1 + @n2 > end > > end > > puts "Enter first number: " > @n1 = gets > puts "Enter second number: " > @n2 = gets > > puts result = Input1(new).sum.to_s > > >