加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

Golang学习笔记 (一)

发布时间:2020-12-16 18:37:43 所属栏目:大数据 来源:网络整理
导读:小记一下go的语法,风格 关于 Exported names ,首字母不是大写的都不能作为输出。也不能被导入到另一个包中然后使用。 int 型在32位系统上为32位,在64位系统上为64位,和 C 一样。 Variables declared without an explicit initial value are given their

小记一下go的语法,风格

  • 关于Exported names ,首字母不是大写的都不能作为输出。也不能被导入到另一个包中然后使用。
  • int型在32位系统上为32位,在64位系统上为64位,和C一样。
  • Variables declared without an explicit initial value are given their zero value.变量未被赋值时:0 for numeric types,
    false the boolean type,and
    “” (the empty string) for strings.
  • import :在同时引入多个包时,可以放在括号中。如
import ( "fmt" "math" )
  • Type conversions:类型转换 The expression T(v) converts the value v to the type T. 类型转换时,必须显式转换,Unlike in C,in Go assignment between items of different type requires an explicit conversion.
  • Type inference: the variable’s type is inferred from the value on the right hand side.
  • fmt.Printf() fmt.Printfln()(输出行)
  • Constants:
    Constants are declared like variables,but with the const keyword.

    *Constants can be character,string,boolean,or numeric values.*
    
              *Constants cannot be declared using the := syntax.*
  • -

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读