Standard library / go/constant
go/constant.Make()
Construct a constant from bool, string, int64, *big.Int, *big.Float or *big.Rat; unsupported types return Unknown. Expected stdout: '2/3\n'.
Formal Syntax & Structure
go syntaxgo
func Make(x any) ValueParameters & Attributes
| Name | Type | Description |
|---|---|---|
| x | any | Input constant or Go value as specified by the function. |
Return Value
Value
Construct a constant from bool, string, int64, *big.
Working Example
Example Snippetgo
package main
import ( "fmt" "go/constant" "math/big")
func main() { fmt.Println(constant.Make(big.NewRat(2, 3)).ExactString()) }