Standard library / math/big

big.Int.Set()

Copies value into receiver; use instead of shallow struct copy. Expected stdout: '42\n'.

Formal Syntax & Structure

go syntaxgo
func (z *Int) Set(x *Int) *Int

Parameters & Attributes

NameTypeDescription
x*IntFirst input operand (or sole input if unary).

Return Value

*Int

Copies value into receiver; use instead of shallow struct copy.

Working Example

Example Snippetgo
package main
import (  "fmt"  "math/big")
func main() {  x := big.NewInt(42)  y := new(big.Int).Set(x)  x.SetInt64(1)  fmt.Println(y)}
Go Reference