一.引用 引用是别名 必须在定义引用时进行初始化.初始化是指明引用指向哪个对象的唯一方法. const 引用是指向 const 对象的引用: ; const int &refVal = ival; // ok: both reference and object are const int &ref2 = ival; // error: non const reference to a const object 可以读取但不能修改 refVal ,因此,任何对 refVal 的赋值都是不合
1.函数只有一个返回值 示例1: package main //必须有一个main包 import "fmt" func myfunc01() int { return 666 } func main() { var a int a = myfunc01() fmt.Println("a = ", a) b := myfunc01() fmt.Println("b = ", b) } 执行结果: a = 666 b = 666 示例2: pack