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 isimport std.ioand callingstdout_write_str(...)unqualified.def main() -> None:: the entry point.Nonemeans “no exit-code-carrying return value”; the process exits with0. Usedef main() -> i32:when you want to return an explicit exit code.io.stdout_write_str(...): returnsbool(success). For propagating I/O errors, the Result-returning variants live alongside (seestd.io).
Variants
Section titled “Variants”Exit code returned explicitly:
def main() -> i32: return 0Multiple writes:
import std.io as io
def main() -> None: io.stdout_write_str("hello, ") io.stdout_write_str("world\n") return None