about summary refs log blame commit diff stats
path: root/tutorial/task7-solution.mu
blob: 9611e0a82b0817ee91db7f62e996f546458d2a4d (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

















                                                                            
fn foo -> _/eax: int {
  var x/edx: int <- copy 0
  # statement 1: store 3 in x
  x <- copy 3
  # statement 2: define a new variable 'y' in register eax and store 4 in it
  var y/eax: int <- copy 4
  # statement 3: add y to x, storing the result in x
  x <- add y
  return x
}

fn test-foo {
  var result/eax: int <- foo
  check-ints-equal result, 7, "F - foo should return 7, but didn't"
}

fn main {
}