aboutsummaryrefslogtreecommitdiff
path: root/exercises/079_quoted_identifiers.zig
diff options
context:
space:
mode:
authorDave Gauer <dave@ratfactor.com>2021-05-09 13:10:09 -0400
committerDave Gauer <dave@ratfactor.com>2021-05-09 13:10:09 -0400
commitde584dcd718b6d55179c00a4ec246f029604ab57 (patch)
tree75d6401a2f47e0aca053cbbd2e4727bb0e4b16f7 /exercises/079_quoted_identifiers.zig
parent22ac3628a15737af8f59d1e3b1d38b74edc7f1b9 (diff)
downloadziglings-de584dcd718b6d55179c00a4ec246f029604ab57.tar.gz
ziglings-de584dcd718b6d55179c00a4ec246f029604ab57.tar.bz2
ziglings-de584dcd718b6d55179c00a4ec246f029604ab57.tar.xz
ziglings-de584dcd718b6d55179c00a4ec246f029604ab57.zip
Add ex079 quoted identifiers
Diffstat (limited to 'exercises/079_quoted_identifiers.zig')
-rw-r--r--exercises/079_quoted_identifiers.zig30
1 files changed, 30 insertions, 0 deletions
diff --git a/exercises/079_quoted_identifiers.zig b/exercises/079_quoted_identifiers.zig
new file mode 100644
index 0000000..a529b60
--- /dev/null
+++ b/exercises/079_quoted_identifiers.zig
@@ -0,0 +1,30 @@
+//
+// Sometimes you need to create an identifier that will not, for
+// whatever reason, play by the naming rules:
+//
+// const 55_cows: i32 = 55; // ILLEGAL: starts with a number
+// const isn't true: bool = false; // ILLEGAL: what even?!
+//
+// If you try to create either of these under normal
+// circumstances, a special Program Identifier Syntax Security
+// Team (PISST) will come to your house and take you away.
+//
+// Thankfully, Zig has a way to sneak these wacky identifiers
+// past the authorities: the @"" identifier quoting syntax.
+//
+// @"foo"
+//
+// Please help us safely smuggle these fugitive identifiers into
+// our program:
+//
+const print = @import("std").debug.print;
+
+pub fn main() void {
+ const 55_cows: i32 = 55;
+ const isn't true: bool = false;
+
+ print("Sweet freedom: {}, {}.\n", .{
+ 55_cows,
+ isn't true,
+ });
+}