Newbie question


#1

Hello,

Newbie question here:

I have written a simple code to test my ruby knowledge. It is as
follows:


class Mastermind

def k(a,b)
v = a+b
put v
end

k(2,3)

end


When I run the class, I want to see the code return the number 5.
However, when I run the code i get an error saying that the method K is
undefined. What is wrong here?


#2

Nevermind - I figured it out. Thanks!

Kaustub Samant wrote in post #961568:

Hello,

Newbie question here:

I have written a simple code to test my ruby knowledge. It is as
follows:


class Mastermind

def k(a,b)
v = a+b
put v
end

k(2,3)

end


When I run the class, I want to see the code return the number 5.
However, when I run the code i get an error saying that the method K is
undefined. What is wrong here?