Constants
package main
import (
"fmt"
"math"
)
// Declare a constant 's' with type string and initialize it with the value "constant"
const s string = "constant"
func main() {
// Print the value of the constant 's'
fmt.Println(s)
// Declare a constant 'n' and initialize it with the value 500000000
const n = 500000000
// Declare a constant 'd' and initialize it with the result of the expression 3e20 / n
const d = 3e20 / n
fmt.Println(d)
// Print the value of 'd' after converting it to int64
fmt.Println(int64(d))
// Print the result of the sine function applied to 'n' from the math package
fmt.Println(math.Sin(n))
}Explanation:
Last updated