28 lines
471 B
Plaintext
Raw Normal View History

2024-08-05 10:39:07 +00:00
main() {
a, b := reverse2(1, 2)
assert a == 2
assert b == 1
c, d, e := reverse3(1, 2, 3)
assert c == 3
assert d == 2
assert e == 1
f, g, h, i := mix4(1, 2, 3, 4)
assert f == 4 + 1
assert g == 3 + 2
assert h == 2 + 3
assert i == 1 + 4
}
2024-08-05 16:47:24 +00:00
reverse2(a Int, b Int) -> (Int, Int) {
2024-08-05 10:39:07 +00:00
return b, a
}
2024-08-05 16:47:24 +00:00
reverse3(a Int, b Int, c Int) -> (Int, Int, Int) {
2024-08-05 10:39:07 +00:00
return c, b, a
}
2024-08-05 16:47:24 +00:00
mix4(a Int, b Int, c Int, d Int) -> (Int, Int, Int, Int) {
2024-08-05 10:39:07 +00:00
return d + a, c + b, b + c, a + d
}