Golang学习笔记 (一)

前端之家收集整理的这篇文章主要介绍了Golang学习笔记 (一)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

小记一下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.*
  • -

猜你在找的Go相关文章