All pastes #456636 Raw Edit

Mine

public text v1 · immutable
#456636 ·published 2007-04-24 22:52 UTC
rendered paste body

# Ask for some numbers 

io.write "Write some numbers: "
var.def x [io.read] c 0 r 0

# Iterate adding them, checking for numbers
# and allowing to stop when no number is found

loop.until (= $c [string.numtok $x " "]) {
 var.def res [string.gettok $x " " $c];
   cond.ifnot (is.num $res) {
      io.write "Found something that is not a number: $res"
      io.write "¿ Stop ?"
      cond.if (string.comp "y" [io.read]) { loop.break }
  } cond.else {
      var.def r [+ $r $res]
  }

  math.inc c
}

# Write total

io.write "Total: " $r