aboutsummaryrefslogtreecommitdiff
path: root/exercises/004_arrays.zig
diff options
context:
space:
mode:
authorMartin Ashby <martin@ashbysoft.com>2022-12-09 22:07:01 +0000
committerMartin Ashby <martin@ashbysoft.com>2022-12-09 22:07:01 +0000
commit0e447c7956410a993614f9337d6219e017722443 (patch)
treec12780891cbbd14b52695df1fe336cc8981de6d9 /exercises/004_arrays.zig
parentbb5b8f115a57fc8c85ac7344fe4dc0b796e32487 (diff)
downloadziglings-0e447c7956410a993614f9337d6219e017722443.tar.gz
ziglings-0e447c7956410a993614f9337d6219e017722443.tar.bz2
ziglings-0e447c7956410a993614f9337d6219e017722443.tar.xz
ziglings-0e447c7956410a993614f9337d6219e017722443.zip
001-024 complete
Diffstat (limited to 'exercises/004_arrays.zig')
-rw-r--r--exercises/004_arrays.zig6
1 files changed, 3 insertions, 3 deletions
diff --git a/exercises/004_arrays.zig b/exercises/004_arrays.zig
index 88fcc78..b6756bb 100644
--- a/exercises/004_arrays.zig
+++ b/exercises/004_arrays.zig
@@ -27,7 +27,7 @@ pub fn main() void {
// (Problem 1)
// This "const" is going to cause a problem later - can you see what it is?
// How do we fix it?
- const some_primes = [_]u8{ 1, 3, 5, 7, 11, 13, 17, 19 };
+ var some_primes = [_]u8{ 1, 3, 5, 7, 11, 13, 17, 19 };
// Individual values can be set with '[]' notation.
// Example: This line changes the first prime to 2 (which is correct):
@@ -40,11 +40,11 @@ pub fn main() void {
// (Problem 2)
// Looks like we need to complete this expression. Use the example
// above to set "fourth" to the fourth element of the some_primes array:
- const fourth = some_primes[???];
+ const fourth = some_primes[3];
// (Problem 3)
// Use the len property to get the length of the array:
- const length = some_primes.???;
+ const length = some_primes.len;
std.debug.print("First: {}, Fourth: {}, Length: {}\n", .{
first, fourth, length,