Ruby - Class Methods | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
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

6th Apr 2021, 7:27 AM
Stifan Kristi
Stifan Kristi - avatar
3 Antworten
+ 1
_____3_____ = .sqr thanks
6th Apr 2021, 12:04 PM
Stifan Kristi
Stifan Kristi - avatar
+ 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.
6th Apr 2021, 7:57 AM
Paul
Paul - avatar
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")
6th Apr 2021, 10:22 AM
CamelBeatsSnake
CamelBeatsSnake - avatar