mirror of
https://github.com/gopl-zh/gopl-zh.github.com.git
synced 2025-12-20 12:44:20 +08:00
ch4: fix code path
This commit is contained in:
@@ -14,9 +14,8 @@ fmt.Printf("%q\n", runes) // "['H' 'e' 'l' 'l' 'o' ',' ' ' '世' '界']"
|
||||
|
||||
append函數對於理解slice底層是如何工作的非常重要,所以讓我們仔細査看究竟是發生了什麽。下面是第一個版本的appendInt函數,專門用於處理[]int類型的slice:
|
||||
|
||||
<u><i>gopl.io/ch4/append</i></u>
|
||||
```Go
|
||||
gopl.io/ch4/append
|
||||
|
||||
func appendInt(x []int, y int) []int {
|
||||
var z []int
|
||||
zlen := len(x) + 1
|
||||
|
||||
Reference in New Issue
Block a user