Fix warning: instance variable @head not initialized
and remove unused instance variable
This commit is contained in:
parent
e64af7d5ad
commit
144b11e03e
@ -5,7 +5,6 @@ class MyElem
|
||||
# @variables are instance variable, no declaration needed
|
||||
@data = item
|
||||
@succ = nil
|
||||
@head = nil
|
||||
end
|
||||
|
||||
def data
|
||||
@ -23,6 +22,10 @@ class MyElem
|
||||
end
|
||||
|
||||
class MyList
|
||||
def initialize
|
||||
@head = nil
|
||||
end
|
||||
|
||||
def add_to_list(obj)
|
||||
elt = MyElem.new(obj)
|
||||
if @head
|
||||
|
Loading…
x
Reference in New Issue
Block a user