Files
compiler-explorer/examples/mojo/default.mojo
Michael Dunn-OConnor 3148f526af Update mojo default example (#8979)
Replaced the default mojo example with a `square` function to align with
other examples. Added an explanatory comment on the decorator and abi
effect.
2026-08-06 07:31:29 -05:00

5 lines
213 B
Mojo

# export + abi("C"): keeps square from being stripped as unused, uses C calling
# convention (no unbound params), and gives it a clean mangled name.
@export
def square(i: Int32) abi("C") -> Int32:
return i * i