上一页 1 ··· 49 50 51 52 53 54 55 56 57 ··· 494 下一页
摘要: Code has error: fn main() { let answer = square(3); println!("The square of 3 is {}", answer); } fn square(num: i32) -> i32 { num * num; } Error: ⚠️ C 阅读全文
posted @ 2024-02-23 15:39 Zhentiw 阅读(18) 评论(0) 推荐(0)
摘要: Constants variable always need to be annotated: const NUMBER: i32 = 3; fn main() { println!("Number {}", NUMBER); } 阅读全文
posted @ 2024-02-23 15:02 Zhentiw 阅读(11) 评论(0) 推荐(0)
摘要: 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 阅读全文
posted @ 2024-02-23 14:59 Zhentiw 阅读(21) 评论(0) 推荐(0)
摘要: 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 阅读全文
posted @ 2024-02-23 14:39 Zhentiw 阅读(14) 评论(0) 推荐(0)
摘要: In this lesson we'll learn how to exit a program using the std::process module in Rust and it's exit() method. use std::io; use std::process; fn main( 阅读全文
posted @ 2024-02-23 14:38 Zhentiw 阅读(28) 评论(0) 推荐(0)
摘要: In this lesson we'll explore how to unwrap a Result type using a language feature called Pattern Matching. use std::io; fn main() { let mut first = St 阅读全文
posted @ 2024-02-23 14:33 Zhentiw 阅读(12) 评论(0) 推荐(0)
摘要: This lesson discusses how to improve error handling by configuring custom error messages using the expect() function. use std::io; fn main() { let mut 阅读全文
posted @ 2024-02-23 14:29 Zhentiw 阅读(13) 评论(0) 推荐(0)
摘要: use std::path::PathBuf; use clap::Parser; #[derive(Parser, Debug)] #[clap()] pub struct Opts { pub args: Vec<String>, #[clap(short = 'c', long = "conf 阅读全文
posted @ 2024-02-21 15:51 Zhentiw 阅读(25) 评论(0) 推荐(0)
摘要: In this lesson you'll learn about Vec<T>, or Vectors. Vectors are like Arrays, a collection of values of the same type, but as opposed to Arrays, Vect 阅读全文
posted @ 2024-02-20 22:36 Zhentiw 阅读(17) 评论(0) 推荐(0)
摘要: In this lesson we take a look at Arrays and the different ways of creating them. Arrays in Rust are collections of values of the same type that cannot 阅读全文
posted @ 2024-02-20 22:32 Zhentiw 阅读(22) 评论(0) 推荐(0)
上一页 1 ··· 49 50 51 52 53 54 55 56 57 ··· 494 下一页