Todd,

I'd be interested to see where someone said 'no' to creating your own methods.

Methods are integral to the whole idea of a class.

It's also clear throughout the Raku documentation that there are methods.

But for a method, you need a class. Peter put the method in a class.

Do you want a method 'outside' a class? If so, what exactly do you think a method outside a class would do?

Richard

On 01/06/2020 21:38, ToddAndMargo via perl6-users wrote:
On 2020-06-01 02:21, Peter Pentchev wrote:
class Thing {
    multi method do-things(Int:D $value) {
        say "A thing can do things with an integer: $value";
    }

    multi method do-things(Rational:D $value) {
        say "A thing can do things with a rational number: $value";
    }
}


Hi Peter,

I have asked this question before.  Is it possible for
me to create my own methods.  The answer came back as
"no".

Did you just demonstrate for me how to create my own
methods?

-T

Reply via email to