Hello, Mojo:
def main():
print("Hello Mojo!")
Uses a new CLI (magic
) as the usual project management utility.
Supports both declared (var
) and implicitly-declared variables. Uses optional type annotations. Indentation scoped. Comments are #
-prefixed single-line.
Functions declared either by def
or by fn
(which requires argument and return types, and raises
if it can raise an error). By default immutable reference argument passing, but allowing for declarations on arguments to indicate by value (owned
) or by reference (read
is immutable reference, mut
as mutable reference).
Structs use Python class syntax, but are entirely static--bound at compile-time--allowing no dynamic dispatch or runtime changes to the struct.
Metaprogramming:
Last modified 28 April 2025