mirror of
https://codeberg.org/ziglings/exercises.git
synced 2026-03-28 21:34:52 +00:00
add hint that @field() works differently on types and values
This commit is contained in:
parent
3ecaa34271
commit
2e981d408f
|
|
@ -118,6 +118,10 @@ fn printTuple(tuple: anytype) void {
|
|||
// @field(foo, "x"); // returns the value at foo.x
|
||||
//
|
||||
// The first field should print as: "0"(bool):true
|
||||
//
|
||||
// Hint: Be careful! If your 'lhs' is a type, @field() looks
|
||||
// for declarations. If it's a value, it looks for data.
|
||||
//
|
||||
print("\"{s}\"({any}):{any} ", .{
|
||||
field.???,
|
||||
field.???,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user