Standard library / reflect
reflect.Value.Equal()
Compare using Go equality rules. Noncomparable values of the same type may panic; check Comparable. Expected stdout: 'true\n'.
Formal Syntax & Structure
go syntaxgo
func (v Value) Equal(u Value) boolParameters & Attributes
| Name | Type | Description |
|---|---|---|
| u | Value | Other reflected value to compare. |
Return Value
bool
Compare using Go equality rules.
Working Example
Example Snippetgo
package main
import ( "fmt" "reflect")
func main() { fmt.Println(reflect.ValueOf(7).Equal(reflect.ValueOf(7))) }