aboutsummaryrefslogtreecommitdiff
path: root/exercises
diff options
context:
space:
mode:
authorDave Gauer <[email protected]>2021-05-09 19:53:14 -0400
committerDave Gauer <[email protected]>2021-05-09 19:53:14 -0400
commit4a379159a3f35e30e34745477eccd2420303264a (patch)
tree050fdf1e545c90c2556e776449629ecf83a9a757 /exercises
parentc43e5480c6d3e084a6e375098564ae4edd900706 (diff)
downloadziglings-4a379159a3f35e30e34745477eccd2420303264a.tar.xz
ziglings-4a379159a3f35e30e34745477eccd2420303264a.zip
add ex083 anon lists
Diffstat (limited to 'exercises')
-rw-r--r--exercises/083_anonymous_lists.zig25
1 files changed, 25 insertions, 0 deletions
diff --git a/exercises/083_anonymous_lists.zig b/exercises/083_anonymous_lists.zig
new file mode 100644
index 0000000..838d40e
--- /dev/null
+++ b/exercises/083_anonymous_lists.zig
@@ -0,0 +1,25 @@
+//
+// Anonymous struct literal syntax can also be used to compose an
+// "anonymous list" with an array type destination:
+//
+// const foo: [3]u32 = .{10, 20, 30};
+//
+// Otherwise it's a "tuple":
+//
+// const bar = .{10, 20, 30};
+//
+// The only difference is the destination type.
+//
+const print = @import("std").debug.print;
+
+pub fn main() void {
+ // Please make 'hello' a string-like array of u8 WITHOUT
+ // changing the value literal.
+ //
+ // Don't change this part:
+ //
+ // = .{'h', 'e', 'l', 'l', 'o'};
+ //
+ const hello = .{'h', 'e', 'l', 'l', 'o'};
+ print("I say {s}!\n", .{hello});
+}