package mainimport ( "fmt")func main() { var a, b = 1, 2 fmt.Println(a, b) b, a = a, b fmt.Println(a, b)}
其他语言不引入临时变量 写法 :
int a = 5, b = 8; a = a+b;b = a-b;a = a-b;
本文共 214 字,大约阅读时间需要 1 分钟。
package mainimport ( "fmt")func main() { var a, b = 1, 2 fmt.Println(a, b) b, a = a, b fmt.Println(a, b)}
其他语言不引入临时变量 写法 :
int a = 5, b = 8; a = a+b;b = a-b;a = a-b;
转载于:https://my.oschina.net/u/1778309/blog/497370