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

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.

主站蜘蛛池模板: 上饶市| 大新县| 定陶县| 克山县| 鞍山市| 丹阳市| 四平市| 科技| 开鲁县| 察雅县| 丰县| 双城市| 迁安市| 青龙| 南丹县| 合肥市| 宜君县| 治多县| 金门县| 枣强县| 云阳县| 道孚县| 上杭县| 安福县| 沙河市| 庆云县| 乌拉特中旗| 南汇区| 清水河县| 团风县| 隆子县| 开化县| 高州市| 肇东市| 平潭县| 咸丰县| 马边| 七台河市| 新沂市| 怀仁县| 顺平县|