mirror of
https://github.com/gopl-zh/gopl-zh.github.com.git
synced 2024-11-28 00:58:54 +00:00
Compare commits
No commits in common. "68692399807e129ecd24c546460a507298d97676" and "56bbafbd084510732427c1af2fe0c7528c8cb53c" have entirely different histories.
6869239980
...
56bbafbd08
@ -35,7 +35,7 @@ x, y = y, x
|
|||||||
a[i], a[j] = a[j], a[i]
|
a[i], a[j] = a[j], a[i]
|
||||||
```
|
```
|
||||||
|
|
||||||
或者是计算两个整数值的的最大公约数(GCD)(译注:Greatest Common Divisor的缩写,欧几里德的GCD是最早的非平凡算法):
|
或者是计算两个整数值的的最大公约数(GCD)(译注:GCD不是那个敏感字,而是greatest common divisor的缩写,欧几里德的GCD是最早的非平凡算法):
|
||||||
|
|
||||||
```Go
|
```Go
|
||||||
func gcd(x, y int) int {
|
func gcd(x, y int) int {
|
||||||
@ -58,7 +58,7 @@ func fib(n int) int {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
元组赋值也可以使一系列琐碎赋值更加紧凑(译注: 特别是在for循环的初始化部分):
|
元组赋值也可以使一系列琐碎赋值更加紧凑(译注: 特别是在for循环的初始化部分),
|
||||||
|
|
||||||
```Go
|
```Go
|
||||||
i, j, k = 2, 3, 5
|
i, j, k = 2, 3, 5
|
||||||
|
Loading…
Reference in New Issue
Block a user