- 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.
推薦閱讀
- UI設計基礎培訓教程
- Boost程序庫完全開發(fā)指南:深入C++”準”標準庫(第5版)
- C# Programming Cookbook
- 劍指Offer(專項突破版):數(shù)據(jù)結構與算法名企面試題精講
- Practical DevOps
- Scratch真好玩:教小孩學編程
- PHP 編程從入門到實踐
- 人臉識別原理及算法:動態(tài)人臉識別系統(tǒng)研究
- Mastering Yii
- HTML5 and CSS3 Transition,Transformation,and Animation
- Learning Network Forensics
- Nginx實戰(zhàn):基于Lua語言的配置、開發(fā)與架構詳解
- Multithreading in C# 5.0 Cookbook
- Terraform:多云、混合云環(huán)境下實現(xiàn)基礎設施即代碼(第2版)
- Go語言編程