mirror of
https://codeberg.org/andyscott/ziglings.git
synced 2024-12-22 14:03:10 -05:00
Update ex005 because no need for pointers
This commit is contained in:
parent
0c9ebd941c
commit
f3e25be7d0
1 changed files with 11 additions and 5 deletions
|
@ -30,17 +30,23 @@ pub fn main() void {
|
||||||
// Okay, that's all of the problems. Let's see the results.
|
// Okay, that's all of the problems. Let's see the results.
|
||||||
//
|
//
|
||||||
// We could print these arrays with leet[0], leet[1],...but let's
|
// We could print these arrays with leet[0], leet[1],...but let's
|
||||||
// have a little preview of Zig "for" loops instead:
|
// have a little preview of Zig 'for' loops instead:
|
||||||
|
//
|
||||||
|
// for (<item array>) |item| { <do something with item> }
|
||||||
|
//
|
||||||
|
// Don't worry, we'll cover looping properly in upcoming
|
||||||
|
// lessons.
|
||||||
|
//
|
||||||
std.debug.print("LEET: ", .{});
|
std.debug.print("LEET: ", .{});
|
||||||
|
|
||||||
for (leet) |*n| {
|
for (leet) |n| {
|
||||||
std.debug.print("{}", .{n.*});
|
std.debug.print("{}", .{n});
|
||||||
}
|
}
|
||||||
|
|
||||||
std.debug.print(", Bits: ", .{});
|
std.debug.print(", Bits: ", .{});
|
||||||
|
|
||||||
for (bit_pattern) |*n| {
|
for (bit_pattern) |n| {
|
||||||
std.debug.print("{}", .{n.*});
|
std.debug.print("{}", .{n});
|
||||||
}
|
}
|
||||||
|
|
||||||
std.debug.print("\n", .{});
|
std.debug.print("\n", .{});
|
||||||
|
|
Loading…
Reference in a new issue