0
Ruby - Class Methods
Ruby Class Methods Fill in the blanks to define a class method called "sqr" for the Calc class and call it with the argument 8. _____1_____ Calc def _____2_____.sqr x x*x end end puts Calc _____3_____ 8 correct answer _____1_____ = class _____2_____ = self question _____3_____ = ? already search the https://www.sololearn.com/Discuss and google but no enlight for this question thanks
3 Antworten
+ 1
_____3_____ = .sqr
thanks
+ 1
If you fail the question in a course, take a look at the comments. But it is even better to study the lesson before the question again. You can find the answer in both.
0
This is how you call a class method. Imagine a class called Language with a class method called communicate_by which takes one argument.
# Class name, then a dot, then the method
Language.communicate_by("writing")