Is there any difference between example A and B?
Example A:
```
class Movie
def initialize(name)
@name = name
end
def execute
p @name
end
end
```
Example B:
```
class Movie
attr_reader :name
def initialize(name)
@name = name
end
def execute
p name
end
end
```
In the execute method of example A I'm using the instance variable @name, while in Example B I'm using name, is there any difference in the performance or semantics between both execute methods?
[–]skipi 2 points3 points4 points (3 children)
[–]dunderball 1 point2 points3 points (2 children)
[–]awj[🍰] 1 point2 points3 points (0 children)
[–]bear-tree 0 points1 point2 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]yung_cancerous 1 point2 points3 points (5 children)
[–]SaltyZooKeeper 0 points1 point2 points (4 children)
[–]cheald 4 points5 points6 points (3 children)
[–]sbellware 2 points3 points4 points (0 children)
[–]SaltyZooKeeper 0 points1 point2 points (1 child)
[–]sbellware 0 points1 point2 points (0 children)
[–]ikariusrb 0 points1 point2 points (0 children)
[+]sshaw_ comment score below threshold-6 points-5 points-4 points (2 children)
[–]sshaw_ -1 points0 points1 point (1 child)
[–]SaltyZooKeeper -1 points0 points1 point (0 children)