标签:
package main import ( "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;
go 交换两个变量的值 忒带劲了
原文地址:http://my.oschina.net/u/1778309/blog/497370