about summary refs log blame commit diff stats
path: root/subx/examples/ex3.k2
blob: aa17ac7b6e36a1434134457cc59a8846cf6aba26 (plain) (tree)



















                                 
fn main [
  var result/EBX : int
  result/EBX <- copy 0
  var counter/ECX : int
  counter/ECX <- copy 1
  {
    compare counter/ECX, 10
    break-if >
    result/EBX <- add counter/ECX
    counter/ECX <- add 1
    loop
  }
  call exit, 1
]

fn exit x : int [
  code/EBX <- copy x
  code/EAX <- copy 1/exit
  syscall
]