Lộ trình học

Struct và interface

Struct, phương thức, con trỏ, interface, embedding, lỗi và generics.

9 bài học · 14 thử thách

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