diff options
Diffstat (limited to 'sample/list.rb')
| -rw-r--r-- | sample/list.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sample/list.rb b/sample/list.rb index 221f7edb16..7458ba0244 100644 --- a/sample/list.rb +++ b/sample/list.rb @@ -22,6 +22,10 @@ class MyElem end class MyList + def initialize + @head = nil + end + def add_to_list(obj) elt = MyElem.new(obj) if @head @@ -75,6 +79,6 @@ $list2.add_to_list(20) $list2.add_to_list(Point.new(4, 5)) $list2.add_to_list($list1) -# parenthesises around method arguments can be ommitted unless ambiguous. +# parenthesises around method arguments can be omitted unless ambiguous. print "list1:\n", $list1, "\n" print "list2:\n", $list2, "\n" |
