zoukankan      html  css  js  c++  java
  • go 常量2

    数值常量

    数值常量是高精度的 _值_。

    一个未指定类型的常量由上下文来决定其类型。

    也尝试一下输出 needInt(Big) 吧。

    package main

    import "fmt"

    const (
        Big = 1 << 100
        Small = Big >> 99
    )

    func needInt(x int) int { return x*10 + 1 }
    func needFloat(x float64) float64 {
        return x * 0.1
    }

    func main() {
        fmt.Println(needInt(Small))
        fmt.Println(needFloat(Small))
        fmt.Println(needFloat(Big))
    }
     

    go语言开发交流qq群 857263711

    保持进步
    希望每个人都能找到自己喜欢的方式生活、工作。

  • 相关阅读:
    6-1
    4-9
    4-5
    4-4
    4-3
    3-10
    作业三2
    作业三1
    课堂练习二
    实验三
  • 原文地址:https://www.cnblogs.com/songhuan999999/p/11187805.html
Copyright © 2011-2022 走看看