Skip to content

Commit 9d465fa

Browse files
authored
Merge pull request #202 from keytsai/fix/typo-ch9-2
Fix typo for ch09-02
2 parents afbe069 + 5455d07 commit 9d465fa

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/ch09-02-recoverable-errors-with-result.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ don't want to include it for rustdoc testing purposes. -->
229229

230230
讀取檔案至字串中算是個常見動作,所以標準函式庫提供了一個方便的函式 `fs::read_to_string` 來開啟檔案、建立新的 `String`、讀取檔案內容、將內容放入該 `String` 並回傳它。不過使用 `fs::read_to_string` 就沒有機會讓我們來解釋所有的錯誤處理,所以我們一開始才用比較長的寫法。
231231

232-
#### `?` 運算子可以用哪裡
232+
#### `?` 運算子可以用在哪裡
233233

234234
`?` 運算子只能用在有函式的回傳值相容於 `?` 使用的值才行。這是因為 `?` 運算子會在函式中提早回傳數值,就像我們在範例 9-6 那樣用 `match` 表達式提早回傳一樣。在範例 9-6 中,`match` 使用的是 `Result` 數值,函式的回傳值必須是 `Result` 才能相容於此 `return`
235235

0 commit comments

Comments
 (0)