Percorso di apprendimento

Struct e interfacce

Struct, metodi, puntatori, interfacce, embedding, errori e generici.

9 lezioni · 14 sfide

  1. Lezione 1 sfida Structs Group related values into your own type with named fields.
  2. Lezione 2 sfide Methods and Receivers Attach functions to a type and choose between value and pointer receivers.
  3. Lezione 2 sfide Pointers Use & and * to share a value instead of copying it.
  4. Lezione 2 sfide Interfaces Describe behavior with an interface that any type can satisfy.
  5. Lezione 2 sfide Struct Embedding and Composition Reuse fields and methods by embedding one struct in another.
  6. Lezione 1 sfida Temperature Converter Convert between Celsius and Fahrenheit with your own number types.
  7. Lezione 2 sfide Error Handling Return errors as values, wrap them with context and check them with errors.Is and errors.As.
  8. Lezione 1 sfida Bank Account with Errors Model deposits and withdrawals that can fail with your own error types.
  9. Lezione 1 sfida Generics Write one function or type that works with many types using type parameters.