S
Spencer Spence
class Calculater
def dothis(x,y)
puts x+y
end
end
object = Calculater.new
@@number = gets
@@number2 = gets
object.doThis(number,number2)
i'm getting this error,
C:\Users\Spencer_2\Documents\NetBeansProjects\RubyApplication1\lib\new_main.rb:12:
undefined local variable or method `number' for main:Object (NameError)
I'm used to programming in java so I assumed that the doThis(x,y)
parameters are just temporary variables in ruby. Am I wrong?
def dothis(x,y)
puts x+y
end
end
object = Calculater.new
@@number = gets
@@number2 = gets
object.doThis(number,number2)
i'm getting this error,
C:\Users\Spencer_2\Documents\NetBeansProjects\RubyApplication1\lib\new_main.rb:12:
undefined local variable or method `number' for main:Object (NameError)
I'm used to programming in java so I assumed that the doThis(x,y)
parameters are just temporary variables in ruby. Am I wrong?