083_anonymous_lists.zig 627 B

12345678910111213141516171819202122232425
  1. //
  2. // Anonymous struct literal syntax can also be used to compose an
  3. // "anonymous list" with an array type destination:
  4. //
  5. // const foo: [3]u32 = .{10, 20, 30};
  6. //
  7. // Otherwise it's a "tuple":
  8. //
  9. // const bar = .{10, 20, 30};
  10. //
  11. // The only difference is the destination type.
  12. //
  13. const print = @import("std").debug.print;
  14. pub fn main() void {
  15. // Please make 'hello' a string-like array of u8 WITHOUT
  16. // changing the value literal.
  17. //
  18. // Don't change this part:
  19. //
  20. // = .{'h', 'e', 'l', 'l', 'o'};
  21. //
  22. const hello = .{'h', 'e', 'l', 'l', 'o'};
  23. print("I say {s}!\n", .{hello});
  24. }