Beginner
Go (Golang)
Q29 / 100
What is a type assertion in Go?
Correct! Well done.
Incorrect.
The correct answer is B) Extracting a concrete type value from an interface: val, ok := i.(ConcreteType)
B
Correct Answer
Extracting a concrete type value from an interface: val, ok := i.(ConcreteType)
Explanation
val, ok := i.(string) safely checks if i holds a string. Without ok, a failed assertion panics.
Progress
29/100