From 2699a3c21d5ee46c7a46113cd0c864b90e8a539a Mon Sep 17 00:00:00 2001 From: InKryption <59504965+InKryption@users.noreply.github.com> Date: Sun, 20 Feb 2022 19:24:36 +0100 Subject: Update information to be accurate to the semantics of string literals --- exercises/006_strings.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'exercises/006_strings.zig') diff --git a/exercises/006_strings.zig b/exercises/006_strings.zig index 8ff98f5..5c4d951 100644 --- a/exercises/006_strings.zig +++ b/exercises/006_strings.zig @@ -9,7 +9,7 @@ // // Is the same as: // -// const foo = [_]u8{ 'H', 'e', 'l', 'l', 'o' }; +// const foo = &[_:0]u8{ 'H', 'e', 'l', 'l', 'o' }; // // Notice how individual characters use single quotes ('H') and // strings use double quotes ("H"). These are not interchangeable! -- cgit v1.2.3-ZIG From ec356407f14cf75163bb263e1e4a8ec20fb6ea56 Mon Sep 17 00:00:00 2001 From: InKryption <59504965+InKryption@users.noreply.github.com> Date: Tue, 22 Feb 2022 02:21:22 +0100 Subject: Revert syntax demo, add note So as to not overwhelm the reader with syntax that is unseen up to this point, use the original demonstration, but add an explanatory note hinting that there is more to the semantics of string literals than shown. --- exercises/006_strings.zig | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'exercises/006_strings.zig') diff --git a/exercises/006_strings.zig b/exercises/006_strings.zig index 5c4d951..5a7172c 100644 --- a/exercises/006_strings.zig +++ b/exercises/006_strings.zig @@ -7,9 +7,11 @@ // // const foo = "Hello"; // -// Is the same as: +// Is almost* the same as: // -// const foo = &[_:0]u8{ 'H', 'e', 'l', 'l', 'o' }; +// const foo = [_]u8{ 'H', 'e', 'l', 'l', 'o' }; +// +// (* We'll see what Zig strings REALLY are in Exercise 77.) // // Notice how individual characters use single quotes ('H') and // strings use double quotes ("H"). These are not interchangeable! -- cgit v1.2.3-ZIG