In Go, can type assertion be used with non-interface types?

  • Maybe
  • No
  • Sometimes
  • Yes
Type assertion in Go allows you to check the dynamic type of an interface variable at runtime. However, it cannot be used with non-interface types directly. Attempting to use type assertion with non-interface types will result in a compile-time error. Type assertion is specifically designed to work with interface types.
Add your answer
Loading...

Leave a comment

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