[Ruby] [ruby] Drill output

less than 1 minute read


Writing code using the concept of classes and instances image.png Make an addition to the above code to get the following output. However, we will use the class and instance. image.png


image.png First, I want to assign (Abe, Ruby’s awesomeness, Awesome Ruby!) to the instance variable declared in the initialize method in lines 3 to 7, so I’ll change the value of the instance variable in lines 9 to 19. Define each instance method to return. Then, in the 21st line, create an instance of the Article class and assign it to the variable article. At that time, as an actual argument (Abe, about the splendor of Ruby, Awesome Ruby!), I will pass it to the formal argument.

Then I was able to summon all of mysterious things.