about summary refs log blame commit diff stats
path: root/archive/2.transect/factorial.k2
blob: 792697735c2b34a26f2566f47af20d9c1baff3f8 (plain) (tree)
aa
# Add the first 10 numbers, and return the result in the exit code.
#
# To run:
#   $ ./translate browse.mu
#   $  echo $?
#   55

fn main -> _/ebx: int {
  var result/ebx: int <- copy 0
  var i/eax: int <- copy 1
  {
    compare i, 0xa
    break-if->
    result <- add i
    i <- increment
    loop
  }
  return result
}