Mode:
Duration:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
class
FACTORIAL
feature
compute (n: INTEGER)
local f, i: INTEGER
do
f := 1
from i := 1 until i > n loop
f := f * i
i := i + 1
end
io.put_string ("Factorial: "); io.put_integer(f); io.put_new_line
end
end
! Run
local
fact: FACTORIAL
do
create fact
fact.compute(5)
endCoding works best on desktop or with an external keyboard.