From 144b11e03ee0994cacd3fa5eb9ff8b87bd627452 Mon Sep 17 00:00:00 2001 From: Kazuhiro NISHIYAMA Date: Sat, 19 Dec 2020 15:24:09 +0900 Subject: Fix `warning: instance variable @head not initialized` and remove unused instance variable --- sample/list.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'sample') 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 -- cgit v1.2.1