12 lines
245 B
Mojo
Generated
12 lines
245 B
Mojo
Generated
def add_two(y: Int):
|
|
# y += 2 # This would cause a compiler error because `y` is immutable
|
|
# We can instead make an explicit copy:
|
|
var z = y
|
|
z += 2
|
|
print("z:", z)
|
|
|
|
def main():
|
|
var x = 1
|
|
add_two(x)
|
|
print("x:", x)
|