aboutsummaryrefslogtreecommitdiff
path: root/exercises/016_for2.zig
diff options
context:
space:
mode:
authorDave Gauer <dave@ratfactor.com>2021-04-10 14:45:25 -0400
committerDave Gauer <dave@ratfactor.com>2021-04-10 14:45:25 -0400
commit4251076b50082023f609e2823b143993f7749b57 (patch)
tree8e307b81417a4755b78d18f34ecfef6777964baa /exercises/016_for2.zig
parent88a8f4788db2fde6f8e957abe3fceacf530d011c (diff)
downloadziglings-4251076b50082023f609e2823b143993f7749b57.tar.gz
ziglings-4251076b50082023f609e2823b143993f7749b57.tar.bz2
ziglings-4251076b50082023f609e2823b143993f7749b57.tar.xz
ziglings-4251076b50082023f609e2823b143993f7749b57.zip
mention builtin ex coming up
Diffstat (limited to 'exercises/016_for2.zig')
-rw-r--r--exercises/016_for2.zig3
1 files changed, 3 insertions, 0 deletions
diff --git a/exercises/016_for2.zig b/exercises/016_for2.zig
index 0a62a1a..1d4496a 100644
--- a/exercises/016_for2.zig
+++ b/exercises/016_for2.zig
@@ -25,6 +25,9 @@ pub fn main() void {
//
// See if you can figure out the missing piece:
for (bits) |bit, ???| {
+ // Note that we convert the usize i to a u32 with
+ // @intCast(), a builtin function just like @import().
+ // We'll learn about these properly in a later exercise.
var place_value = std.math.pow(u32, 2, @intCast(u32, i));
value += place_value * bit;
}