File: example2.e

package info (click to toggle)
smarteiffel 1.1-11
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 12,288 kB
  • ctags: 40,785
  • sloc: ansic: 35,791; lisp: 4,036; sh: 1,783; java: 895; ruby: 613; python: 209; makefile: 115; csh: 78; cpp: 50
file content (59 lines) | stat: -rw-r--r-- 1,890 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
class EXAMPLE2
--
-- To start with TUPLE, just compile an run it :
--
--            compile -o example2 -boost example2
--

creation make

feature

   make is
      local
         my_very_long_tuple: TUPLE[INTEGER,STRING,INTEGER,
				   INTEGER,STRING,INTEGER,
				   INTEGER,STRING,INTEGER]
      do
	 -- Creation of a new TUPLE:
         my_very_long_tuple := [1,"Benedicte",1993,
				2,"Lucien",1995,
				3,"Marie",1997]

	 -- Accessing:
	 io.put_string("my_very_long_tuple.count = ")
         io.put_integer(my_very_long_tuple.count)
         io.put_string("%Nmy_very_long_tuple.first = ")
         io.put_integer(my_very_long_tuple.first)
         io.put_string("%Nmy_very_long_tuple.second = ")
         io.put_string(my_very_long_tuple.second)
         io.put_string("%Nmy_very_long_tuple.third = ")
         io.put_integer(my_very_long_tuple.third)
         io.put_string("%Nmy_very_long_tuple.fourth = ")
         io.put_integer(my_very_long_tuple.fourth)
         io.put_string("%Nmy_very_long_tuple.fifth = ")
         io.put_string(my_very_long_tuple.fifth)
         io.put_string("%Nmy_very_long_tuple.item_6 = ")
         io.put_integer(my_very_long_tuple.item_6)
         io.put_string("%Nmy_very_long_tuple.item_7 = ")
         io.put_integer(my_very_long_tuple.item_7)
         io.put_string("%Nmy_very_long_tuple.item_8 = ")
         io.put_string(my_very_long_tuple.item_8)
         io.put_string("%Nmy_very_long_tuple.item_9 = ")
         io.put_integer(my_very_long_tuple.item_9)
	 io.put_character('%N')

	 -- Writing:
	 my_very_long_tuple.set_first(0)
	 my_very_long_tuple.set_second(Void)
	 my_very_long_tuple.set_third(0)
	 my_very_long_tuple.set_fourth(0)
	 my_very_long_tuple.set_fifth(Void)
	 my_very_long_tuple.set_item_6(0)
	 my_very_long_tuple.set_item_7(0)
	 my_very_long_tuple.set_item_8(Void)
	 my_very_long_tuple.set_item_9(0)
      end

end -- EXAMPLE2