Files
ivy/doc/sample/Sum.im

30 lines
437 B
Plaintext
Raw Normal View History

2024-11-02 15:11:00 +00:00
package net.doorstuck.test
cout put:'Finds the sum of a set of numbers.'
sum = 0
while true do
cout print:'Number (blank to finish): '
cout flush
input = ''
v = 0
cin get:input
if input == '' then
break
end
try
v = Int parse:input
catch (#err:number_format, err)
cout put:'{input} is not a valid number.'
continue
end
sum += v
end
cout put:'Sum: {sum}'