摘要:
fn multiply(x: i64, y: u8) -> i64 { return x * (y as i64); } Here we convert u8to i64, which is possible since i64has a wider range than u8; but you c 阅读全文
摘要:
fn main() { let a = 0..100; if a.len() >= 100 { println!("Wow, that's a big array!"); } else { println!("Meh, I eat arrays like that for breakfast."); 阅读全文
摘要:
pub fn is_even(num: i32) -> bool { num % 2 == 0 } /* This attribute indicates that the following module is a conditional compilation module that shoul 阅读全文
摘要:
Ref to : https://doc.rust-lang.org/book/ch03-01-variables-and-mutability.html#shadowing fn main() { let number = "T-H-R-E-E"; // don't change this lin 阅读全文
摘要:
This lesson shows how to use a Rust loop to run a program infinitely. use std::io; use std::process; fn main() { loop { println!("Please enter a first 阅读全文