\documentclass[debug]{microstructure} \author{DistressNetwork°} \lstset{escapechar=§} \begin{document} \resetv{-3\unit}\section{Hello world in Zig} This is an example `hello world' program. \vspace{-0.5\unit}{\footnotesize\italic{*:}}\vspace{-1\unit} \begin{codeblock} §\textrm{\italic{(Imports)}}§ pub fn main() !void { §\textrm{\italic{(Print)}}§ } \end{codeblock} We first import the standard library. \vspace{-0.5\unit}{\footnotesize\italic{Imports:}}\vspace{-1\unit} \begin{codeblock} const std = @import("std"); \end{codeblock} Then we print the desired string. \vspace{-0.5\unit}{\footnotesize\italic{Print:}}\vspace{-1\unit} \begin{codeblock} std.debug.print("Hello world\n", .{}); \end{codeblock} We can also print using a format string. \vspace{-0.5\unit}{\footnotesize\italic{+ Print:}}\vspace{-1\unit} \begin{codeblock} std.debug.print("Hello world {s}\n", .{"again"}); \end{codeblock} Or we can use a \mono{writer()} method and write to stdout directly. \vspace{-0.5\unit}{\footnotesize\italic{+ Imports:}}\vspace{-1\unit} \begin{codeblock} const write = std.io.getStdOut().writer().write; \end{codeblock} \vspace{-0.5\unit}{\footnotesize\italic{+ Print:}}\vspace{-1\unit} \begin{codeblock} _ = try write("Hello stdout\n"); \end{codeblock} \end{document}