about summary refs log blame commit diff stats
path: root/tutorial/task11-solution.mu
blob: 851404707d98390f054311659097c948693ba0d0 (plain) (tree)





















                                                                 
fn difference a: int, b: int -> _/eax: int {
  var result/eax: int <- copy a
  result <- subtract b
  compare result, 0
  {
    break-if->=
    result <- negate
  }
  return result
}

fn test-difference {
  var result/eax: int <- difference 5, 3
  check-ints-equal result, 2, "F - difference works"
  result <- difference 3, 5
  check-ints-equal result, 2, "F - difference is always positive"
  result <- difference 6, 6
  check-ints-equal result, 0, "F - difference can be 0"
}

fn main screen: (addr screen) {
}