11. Why do we need attr_accessor :radians?

For this code, why did we need attr_accessor? Isn’t the only time we use radians when we call it at the end? I thought that is why we had the initialize method. I’m not really sure what all the attr type functions do or why they are necessary. Can anyone explain?

class Angle
include Math
attr_accessor :radians

def initialize(radians)
@radians = radians

def cosine

acute = Angle.new(1)

Glad to hear I am not the only one who is struggling with the attr_ objects? methods? modules??
(see what I mean)

attr_accessor creates getter and setter methods for your radians so that it can be get and set from outside the class

methods are like functions but they are called with the context of some object. my_car.unlock_doors would call the unlock_doors method and it would know which car to do it for

modules are for creating namespaces so that when you write code you don’t have to worry about what names that other pieces of code are using.

And this topic is OLD X_x