* io.c (rb_open_file): encoding in mode string was ignored if perm is
[ruby-svn.git] / sample / list2.rb
blob914cb8996efa5e95ade3bf47946110d33ddb4111
1 # Linked list example -- short version
2 class Point
3   def initialize(x, y)
4     @x = x; @y = y
5     self
6   end
8   def to_s
9     sprintf("%d@%d", @x, @y)
10   end
11 end
12     
13 list1 = [10, 20, Point.new(2, 3), Point.new(4, 5)]
14 list2 = [20, Point.new(4, 5), list1]
15 print("list1:\n", list1.join("\n"), "\n")
16 print("list2:\n", list2.join("\n"), "\n")