diff options
Diffstat (limited to 'lang/zig/struct-name.zig')
-rw-r--r-- | lang/zig/struct-name.zig | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lang/zig/struct-name.zig b/lang/zig/struct-name.zig new file mode 100644 index 0000000..8c3affc --- /dev/null +++ b/lang/zig/struct-name.zig @@ -0,0 +1,14 @@ +const print = @import("std").debug.print; + +pub fn main() void { + const Foo = struct {}; + print("variable: {}\n", .{@typeName(Foo)}); + print("anonymous: {}\n", .{@typeName(struct {})}); + print("function: {}\n", .{@typeName(List(i32))}); +} + +fn List(comptime T: type) type { + return struct { + x: T, + }; +} |