Skip to content

Hello, world

The smallest useful Zmeu program.

import std.io as io
def main() -> None:
io.stdout_write_str("Hello, World!\n")

What’s worth noticing:

  • import std.io as io: aliased import. The alternative is import std.io and calling stdout_write_str(...) unqualified.
  • def main() -> None:: the entry point. None means “no exit-code-carrying return value”; the process exits with 0. Use def main() -> i32: when you want to return an explicit exit code.
  • io.stdout_write_str(...): returns bool (success). For propagating I/O errors, the Result-returning variants live alongside (see std.io).

Exit code returned explicitly:

def main() -> i32:
return 0

Multiple writes:

import std.io as io
def main() -> None:
io.stdout_write_str("hello, ")
io.stdout_write_str("world\n")
return None