mirror of
https://github.com/gopl-zh/gopl-zh.github.com.git
synced 2025-08-09 00:22:41 +00:00
ch5: fix code path
This commit is contained in:
@@ -47,8 +47,8 @@
|
||||
|
||||
5.2節的findLinks函數使用了輔助函數visit,遍歷和操作了HTML頁面的所有結點。使用函數值,我們可以將遍歷結點的邏輯和操作結點的邏輯分離,使得我們可以複用遍歷的邏輯,從而對結點進行不同的操作。
|
||||
|
||||
<u><i>gopl.io/ch5/outline2</i></u>
|
||||
```Go
|
||||
gopl.io/ch5/outline2
|
||||
// forEachNode針對每個結點x,都會調用pre(x)和post(x)。
|
||||
// pre和post都是可選的。
|
||||
// 遍歷孩子結點之前,pre被調用
|
||||
|
Reference in New Issue
Block a user