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) *Int

Parameters & Attributes

NameTypeDescription
x*IntFirst input operand (or sole input if unary).
y*IntSecond 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)))}
Go Reference