Forum: Ferret Newbie question

A0a6b5138a5017a89a20d1583f0547c5?d=identicon&s=25 Kaustub Samant (samkas)
on 2010-11-15 15:39
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?
A0a6b5138a5017a89a20d1583f0547c5?d=identicon&s=25 Kaustub Samant (samkas)
on 2010-11-15 15:50
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?
This topic is locked and can not be replied to.