Standard library / math/big
big.Int.Sub()
Stores x-y in receiver. Expected stdout: '42\n'.
Formal Syntax & Structure
go syntaxgo
func (z *Int) Sub(x, y *Int) *IntParameters & Attributes
| Name | Type | Description |
|---|---|---|
| x | *Int | First input operand (or sole input if unary). |
| y | *Int | Second input operand. |
Return Value
*Int
Stores x-y in receiver.
Working Example
Example Snippetgo
package main
import ( "fmt" "math/big")
func main() { fmt.Println(new(big.Int).Sub(big.NewInt(50), big.NewInt(8)))}