Standard library / math/big
big.Int.Cmp()
Compares x and y, returning -1, 0 or +1. Expected stdout: '-1\n'.
Formal Syntax & Structure
go syntaxgo
func (x *Int) Cmp(y *Int) (r int)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| y | *Int | Second input operand. |
Return Value
(r int)
Compares x and y, returning -1, 0 or +1.
Working Example
Example Snippetgo
package main
import ( "fmt" "math/big")
func main() { fmt.Println(big.NewInt(2).Cmp(big.NewInt(3)))}