mirror of
https://github.com/gopl-zh/gopl-zh.github.com.git
synced 2024-11-24 07:14:47 +00:00
Compare commits
2 Commits
56bbafbd08
...
6869239980
Author | SHA1 | Date | |
---|---|---|---|
|
6869239980 | ||
|
0cb5d25bfb |
@ -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)(译注:GCD不是那个敏感字,而是greatest common divisor的缩写,欧几里德的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