官术网_书友最值得收藏!

Expressions

The instructions that tell the computer to do something in a Rust program are almost all expressions. An expression tells the computer how to compute a particular value, and produces that value as its result. In math, 2 + 2 is an expression with a resulting value of 4. Similarly, (2 + 2) - 1 is an expression with a resulting value of 3, which is itself made up of an addition expression and a subtraction expression. In Rust, the same basic idea applies: expressions tell the computer how to find a value, and they can be combined together, because using an expression that produces a value has the same result as using that value directly, just as writing (2 + 2) - 1 has the same result as writing 4 - 1.

Not all expressions in Rust look like math, though. Rust is a programming language, not just a calculator. It's the idea of expressions, which combine values to produce new values, that matters.

主站蜘蛛池模板: 西充县| 克什克腾旗| 陆河县| 山阳县| 莲花县| 大姚县| 金山区| 道孚县| 牡丹江市| 高邮市| 永川市| 织金县| 汽车| 仲巴县| 田林县| 自治县| 鹤山市| 乡城县| 万载县| 宜都市| 平湖市| 金平| 江安县| 弋阳县| 万载县| 洞头县| 锦屏县| 贵州省| 霸州市| 台山市| 吉首市| 栾城县| 新余市| 山阳县| 九龙县| 英山县| 台前县| 民丰县| 澳门| 扎鲁特旗| 山阴县|