Comprehensive Rust(繁体中文) 202406
6 巨集 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 6.7 練習:考拉茲序列 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 6.7.1 解決方案 . . . . . . . . minutes break 和 continue 4 minutes 區塊 (block) 和範疇 (scope) 5 minutes 函式 3 minutes 巨集 2 minutes 練習:考拉茲序列 15 minutes 6.1 if 表達式 你可以像在其他語言中使用 if 陳述式那樣地使用 if 表達式: fn main() { let x = 10; if x == 0 { println 本節的重點在於,上述的便利性不僅常見,而且確實存在,學員需瞭解如何運用。至於為何將便利性定義為 巨集,以及巨集展開後會變成什麼內容,則沒有那麼重要。 本課程不會探討如何定義巨集,但後續章節將說明衍生巨集的用法。 6.7 練習:考拉茲序列 The Collatz Sequence is defined as follows, for an arbitrary n1 greater than zero: • If ni is 1,0 码力 | 356 页 | 1.41 MB | 1 年前3
共 1 条
- 1