master
1#target=x86_64-linux-selfhosted
2#target=x86_64-windows-selfhosted
3#target=wasm32-wasi-selfhosted
4#update=initial version
5#file=main.zig
6const std = @import("std");
7fn Printer(message: []const u8) type {
8 return struct {
9 fn print() !void {
10 try std.fs.File.stdout().writeAll(message);
11 }
12 };
13}
14pub fn main() !void {
15 try Printer("foo\n").print();
16 try Printer("bar\n").print();
17}
18#expect_stdout="foo\nbar\n"
19#update=change line number
20#file=main.zig
21const std = @import("std");
22
23fn Printer(message: []const u8) type {
24 return struct {
25 fn print() !void {
26 try std.fs.File.stdout().writeAll(message);
27 }
28 };
29}
30pub fn main() !void {
31 try Printer("foo\n").print();
32 try Printer("bar\n").print();
33}
34#expect_stdout="foo\nbar\n"