PageRenderTime 12ms CodeModel.GetById 10ms app.highlight 0ms RepoModel.GetById 1ms app.codeStats 1ms

/tutorial/number/example2.e

http://github.com/tybor/Liberty
Specman e | 38 lines | 28 code | 5 blank | 5 comment | 0 complexity | 4aa9957ca0a7e56f00d82c5a78b4f657 MD5 | raw file
 1class EXAMPLE2
 2   --
 3   -- To start with NUMBERs, just compile an run it :
 4   --
 5   --            compile -o example2 -boost example2
 6   --
 7
 8create {ANY}
 9   make
10
11feature {ANY}
12   make
13      local
14         n1, n2, n3: NUMBER
15      do
16         n1 := ("1/3").to_number
17         n2 := 1.to_number / 3.to_number
18         n3 := n1 + n2
19         io.put_number(n1)
20         io.put_string(" + ")
21         io.put_number(n2)
22         io.put_string(" = ")
23         io.put_number(n3)
24         io.put_new_line
25         io.put_number(n1)
26         io.put_string(" + ")
27         io.put_number(n3)
28         io.put_string(" = ")
29         io.put_number(n1 + n3)
30         io.put_string("[
31
32            Do you like NUMBERs ?
33            Have a look at example #3 to know more about NUMBERs.
34
35                        ]")
36      end
37
38end -- class EXAMPLE2