Another week of Ruby went better than last week. This week(October 25-29th) was great, I honestly felt I was finally understanding the jargon as they say. In my lesson of Ruby, Object Oriented Programming 1 and 2 was great for my understanding. The syntax below was easy to use.
@class_variable = parameter
The reason why I choose this syntax is because I am now confident in how to breakdown what I am looking at...somewhat.
When I look at that syntax above I first noticed that there is a class that we define as ClassName followed by the method that will be defined as method_name, we then need a parameter that will go into the parenthesis. Once we have our parameter we then can assign it to equal to the variable which is why we see @class_variable = parameter.
In the example below dog was used to insert in the ClassName section. We then created a method to initialize within the class of Dog.
After we use the initialize method, we insert two parameters, name and breed.
Inside that initialize method we can now assign those two parameters to the variables @name and @breed respectively
def initialize(name, breed)
@name = name
@breed = breed
Another thing I wanted to add that Gino(Mentor) would ALWAYS remind me is that whenever you have a class, make sure to include end when the code is complete but ALSO when defining a method you have to add end for that as well which is why we see not one but two "end"s on the bottom of this particular code.
Again, I may have not have the correct jargon or terminology but this is coming from a 42 year old that is in the process of switching careers from Teaching to this. So far I am enjoying it and learning at my own pace.