79616815

Date: 2025-05-11 18:57:43
Score: 1
Natty:
Report link

A value x of non-interface type X and a value t of interface type T can be compared if type X is comparable and X implements T. They are equal if t's dynamic type is identical to X and t's dynamic value is equal to x.

https://go.dev/ref/spec#Comparison_operators

so in the example above, everything implements any, so hello can be compared against any comparable type. but they will only be equal if the types are equal and values are equal

Reasons:
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: user615344