- 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.
推薦閱讀
- Python爬蟲開發(fā):從入門到實(shí)戰(zhàn)(微課版)
- 劍指JVM:虛擬機(jī)實(shí)踐與性能調(diào)優(yōu)
- PHP程序設(shè)計(jì)(慕課版)
- MATLAB實(shí)用教程
- JavaScript 程序設(shè)計(jì)案例教程
- Spring Boot企業(yè)級(jí)項(xiàng)目開發(fā)實(shí)戰(zhàn)
- 自制編程語言
- Learning OpenCV 3 Computer Vision with Python(Second Edition)
- BeagleBone Black Cookbook
- 愛上micro:bit
- Java高并發(fā)核心編程(卷1):NIO、Netty、Redis、ZooKeeper
- Python Interviews
- Python趣味編程與精彩實(shí)例
- 深入理解BootLoader
- IPython Interactive Computing and Visualization Cookbook