mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
34 lines
797 B
Text
34 lines
797 B
Text
#target=x86_64-linux-selfhosted
|
|
#target=x86_64-windows-selfhosted
|
|
#target=wasm32-wasi-selfhosted
|
|
#update=initial version
|
|
#file=main.zig
|
|
const std = @import("std");
|
|
fn Printer(message: []const u8) type {
|
|
return struct {
|
|
fn print() !void {
|
|
try std.fs.File.stdout().writeAll(message);
|
|
}
|
|
};
|
|
}
|
|
pub fn main() !void {
|
|
try Printer("foo\n").print();
|
|
try Printer("bar\n").print();
|
|
}
|
|
#expect_stdout="foo\nbar\n"
|
|
#update=change line number
|
|
#file=main.zig
|
|
const std = @import("std");
|
|
|
|
fn Printer(message: []const u8) type {
|
|
return struct {
|
|
fn print() !void {
|
|
try std.fs.File.stdout().writeAll(message);
|
|
}
|
|
};
|
|
}
|
|
pub fn main() !void {
|
|
try Printer("foo\n").print();
|
|
try Printer("bar\n").print();
|
|
}
|
|
#expect_stdout="foo\nbar\n"
|