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.*
    
  • -
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值