摘要: ``` fn main() { let number = 6; if number % 4 == 0 { println!("number is divisible by 4"); } else if number % 3 == 0 { println!("number is divisible by 3"); } else if ... 阅读全文
posted @ 2019-12-01 01:49 公众号python学习开发 阅读(190) 评论(0) 推荐(0) 编辑
摘要: ``` fn main() { println!("Hello, world!"); another_function(2,3); let y ={ let x =3; //表达式的结尾没有分号,如果在表达式的结尾加上分号,它就变成了语句,而语句不会返回值。 x+1 }; println!(" the value in main of y is {}",y); let x = five(); pr 阅读全文
posted @ 2019-12-01 01:36 公众号python学习开发 阅读(257) 评论(0) 推荐(0) 编辑
摘要: ``` fn main() { //char支持4个字节,支持emoji let jp = "ゆ"; let emoji = "✨"; let ch = "囧"; println!("jp is {}",jp); println!("ch is {}",ch); println!("emoji is {}",emoji); //元组,同python不可变 let tup:(i32,f64,u8) 阅读全文
posted @ 2019-12-01 01:24 公众号python学习开发 阅读(211) 评论(0) 推荐(0) 编辑
摘要: ``` fn main() { //let x = 5; let mut x = 5; //通过const定义常量名称要大写,并且值不可更改 const Y:i32=6; println!("Y is {}",Y); println!("The value of x is {}", x); x = 6; println!("The value of x is {}", x); //如果要覆盖上一个 阅读全文
posted @ 2019-12-01 01:04 公众号python学习开发 阅读(155) 评论(0) 推荐(0) 编辑
摘要: ``` use std::io; use rand::Rng; use std::cmp::Ordering; fn main() { println!("Guess the number!"); let secret_number = rand::thread_rng().gen_range(1,101); loop { println!("Please input your guess."); 阅读全文
posted @ 2019-12-01 00:48 公众号python学习开发 阅读(262) 评论(0) 推荐(0) 编辑