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

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.

主站蜘蛛池模板: 威远县| 巴马| 雅江县| 澄城县| 高青县| 晋宁县| 乾安县| 丹棱县| 饶阳县| 肥西县| 伊川县| 西充县| 平武县| 大荔县| 类乌齐县| 甘南县| 当阳市| 大理市| 昔阳县| 禹城市| 彰化县| 静宁县| 百色市| 大竹县| 中山市| 兴山县| 绍兴县| 鸡西市| 龙陵县| 通山县| 乐昌市| 巨野县| 清水河县| 武义县| 图片| 德惠市| 麻栗坡县| 嘉鱼县| 三都| 茶陵县| 白河县|