- Learning Rust
- Paul Johnson Vesa Kaihlavirta
- 91字
- 2021-07-02 23:07:15
Creating a variable
To create a new variable binding in Rust, we use the following form:
let x = 1;
This means that we create a new variable binding called x whose content will be 1. The default type for numbers depends on the situation a bit, but usually it's a 32-bit signed integer. If we need a variable that can change, we use this form:
let mut x = 1;
By default, all variables in Rust are non-mutable; therefore, we have to explicitly define a variable as being mutable.
推薦閱讀
- 演進式架構(原書第2版)
- 玩轉Scratch少兒趣味編程
- Learning Java Functional Programming
- Android開發精要
- 編寫高質量代碼:改善Python程序的91個建議
- Learn Programming in Python with Cody Jackson
- AutoCAD VBA參數化繪圖程序開發與實戰編碼
- Django 3.0入門與實踐
- Django 5企業級Web應用開發實戰(視頻教學版)
- Python 3.8編程快速入門
- 設計模式之禪
- 構建跨平臺APP:響應式UI設計入門
- SQL優化核心思想
- Getting Started with SpriteKit
- Python商業數據分析:零售和電子商務案例詳解(雙色)