doc: add intermediate representation language
This commit is contained in:
@@ -1,29 +1,28 @@
|
||||
package net.doorstuck.test
|
||||
|
||||
cout put:'Finds the sum of a set of numbers.'
|
||||
cout put:'Finds the sum of a set of numbers.'.
|
||||
|
||||
sum = 0
|
||||
sum = 0.
|
||||
|
||||
while true do
|
||||
cout print:'Number (blank to finish): '
|
||||
cout flush
|
||||
cout print:'Number (blank to finish): '.
|
||||
cout flush.
|
||||
|
||||
input = ''
|
||||
v = 0
|
||||
cin get:input
|
||||
v = 0.
|
||||
input = cin readLine.
|
||||
|
||||
if input == '' then
|
||||
break
|
||||
end
|
||||
|
||||
try
|
||||
v = Int parse:input
|
||||
catch (#err:number_format, err)
|
||||
cout put:'{input} is not a valid number.'
|
||||
v = Int parse:input.
|
||||
|
||||
if v == null then
|
||||
cout put:'{input} is not a valid number.'.
|
||||
continue
|
||||
end
|
||||
|
||||
sum += v
|
||||
sum += v.
|
||||
end
|
||||
|
||||
cout put:'Sum: {sum}'
|
||||
|
||||
Reference in New Issue
Block a user