PageRenderTime 4ms CodeModel.GetById 1ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/tutorial/iterator/example2.e

http://github.com/tybor/Liberty
Specman e | 35 lines | 27 code | 5 blank | 3 comment | 0 complexity | c8a6bafe4f84865080ece6355d7ef606 MD5 | raw file
 1class EXAMPLE2
 2   --
 3   -- Using an ITERATOR to traverse a random collection of INTEGER.
 4   --
 5
 6create {ANY}
 7   make
 8
 9feature {}
10   iterator: ITERATOR_ON_RANDOM_GENERATOR
11
12   make
13      do
14         create iterator.make(10)
15         io.put_string("First traversal :%N")
16         traverse
17         io.put_string("Second traversal :%N")
18         traverse
19      end
20
21   traverse
22      do
23         from
24            iterator.start
25         until
26            iterator.is_off
27         loop
28            io.put_integer(iterator.item)
29            io.put_character(' ')
30            iterator.next
31         end
32         io.put_new_line
33      end
34
35end -- class EXAMPLE2