Mode:
Duration:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
class
REVERSE_STRING
feature
reverse (s: STRING)
local i: INTEGER; result: STRING
do
create result.make_empty
from i := s.count until i = 0 loop
result.append_character(s[i])
i := i - 1
end
io.put_string(result); io.put_new_line
end
end
! Run
local
r: REVERSE_STRING
s: STRING
do
create r
s := "Hello"
r.reverse(s)
endCoding works best on desktop or with an external keyboard.