diff options
author | Kazuhiro NISHIYAMA <[email protected]> | 2020-12-19 15:24:09 +0900 |
---|---|---|
committer | Kazuhiro NISHIYAMA <[email protected]> | 2020-12-19 15:24:09 +0900 |
commit | 144b11e03ee0994cacd3fa5eb9ff8b87bd627452 (patch) | |
tree | 8ee028eb1f7ef8f4d87f3c083e4577906e7d4cc9 | |
parent | e64af7d5ad8791cc8fe5ea4e75072e3857bcb270 (diff) |
Fix `warning: instance variable @head not initialized` and remove unused instance variable
-rw-r--r-- | sample/list.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sample/list.rb b/sample/list.rb index b4d1d653e4..7458ba0244 100644 --- a/sample/list.rb +++ b/sample/list.rb @@ -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 |