Advanced Go (Golang)
Q63 / 100

What is generics in Go 1.18 and what are type constraints?

Correct! Well done.

Incorrect.

The correct answer is B) Type parameters with constraints (interfaces) specifying what operations a type parameter must support

B

Correct Answer

Type parameters with constraints (interfaces) specifying what operations a type parameter must support

Explanation

func Min[T constraints.Ordered](a, b T) T uses a type parameter T constrained to Ordered. The compiler generates specialized code or uses GC shape stenciling.

Progress
63/100