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

  • Learning Rust
  • Paul Johnson Vesa Kaihlavirta
  • 83字
  • 2021-07-02 23:07:15

How can we tell the compiler that we want x to be an int?

Rust has a way of informing both the compiler and the developer of the variable type. For example, for a 32-bit int, we would use the following:

let x = 1i32; 

In other words, x = 1, a 32-bit signed int.

If a variable is defined without the i32 (or any other value), the compiler will decide the type depending on how the value is used, defaulting to i32.

主站蜘蛛池模板: 花垣县| 长岭县| 肥城市| 拜泉县| 高雄县| 柯坪县| 理塘县| 马关县| 尤溪县| 淮安市| 思茅市| 彭阳县| 长海县| 邳州市| 偃师市| 玉田县| 忻城县| 蒙城县| 通渭县| 迁西县| 河池市| 江源县| 朔州市| 西乌珠穆沁旗| 嵊泗县| 永昌县| 临泉县| 博客| 顺义区| 巴东县| 衡山县| 天峻县| 自治县| 乌兰察布市| 肥乡县| 宜良县| 安化县| 云浮市| 同江市| 成都市| 易门县|