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

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.

主站蜘蛛池模板: 勃利县| 海南省| 漯河市| 古浪县| 禹城市| 仁寿县| 延长县| 肇州县| 资兴市| 淅川县| 龙井市| 马鞍山市| 卓资县| 无棣县| 额济纳旗| 桦川县| 阳原县| 墨玉县| 五河县| 盐津县| 庆阳市| 宿迁市| 星座| 黄陵县| 邻水| 乐昌市| 简阳市| 万州区| 贺兰县| 固原市| 天长市| 康马县| 巴林左旗| 郑州市| 长治县| 托克托县| 奉贤区| 上犹县| 富裕县| 鄂州市| 黔东|