mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Fix warning: instance variable @head not initialized
and remove unused instance variable
This commit is contained in:
parent
e64af7d5ad
commit
144b11e03e
1 changed files with 4 additions and 1 deletions
|
@ -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…
Add table
Reference in a new issue