Curriculum Types & methods Structs
Structs
type Foo struct { ... }. A struct is a typed record — fields and their types, nothing else. No methods on the struct itself (those come next). Field access with .. Struct literals can be positional or named; named is the only sane choice for anything with more than two fields.
9 ready
01
pick one Translate the TypeScript record User into the idiomatic Go
02
pick oneConstruct a struct value. Pick the IDIOMATIC Go literal — named
03
pick one What does the bare declaration var u User produce, before any
04
fill blanks Type the field-access expression. Same . operator as
05
fill blanksType the FIELD NAME that's missing from this struct literal.
06
type one lineTS-leak alert. In TypeScript, passing an object to a function
07
type one line Structs can hold other structs. Field access just chains — .
08
write a programBuild a small program that:
09
write a programTheme capstone: build a small program with NESTED structs and