A type assertion on a nil interface value will always ___.

  • Panic
  • Return nil
  • Compile successfully
  • Result in a runtime error
A type assertion on a nil interface value will always return nil. In Go, a nil interface does not hold any value or type, so any type assertion on a nil interface will return a nil value for the type being asserted. This behavior is a safe and predictable way to handle type assertions when the underlying interface is nil.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *