1
0
Fork 0
mirror of https://github.com/ratfactor/ziglings synced 2024-05-05 01:56:03 +02:00
ziglings/exercises/083_anonymous_lists.zig
Manlio Perillo 88e9e785ef Ensure the exercises use the canonical format
Add the check-exercises.py tool in the new tools directory.  It is used
to check that the exercises are correctly formatted, printing on stderr
the invalid ones and the diff in the unified format.

Update the exercises that don't use the canonical zig fmt format.

Update some patches that cause the generated zig file to be incorrectly
formatted.
2023-04-18 18:16:19 +02:00

26 lines
631 B
Zig

//
// Anonymous struct literal syntax can also be used to compose an
// "anonymous list" with an array type destination:
//
// const foo: [3]u32 = .{10, 20, 30};
//
// Otherwise it's a "tuple":
//
// const bar = .{10, 20, 30};
//
// The only difference is the destination type.
//
const print = @import("std").debug.print;
pub fn main() void {
// Please make 'hello' a string-like array of u8 WITHOUT
// changing the value literal.
//
// Don't change this part:
//
// = .{ 'h', 'e', 'l', 'l', 'o' };
//
const hello = .{ 'h', 'e', 'l', 'l', 'o' };
print("I say {s}!\n", .{hello});
}