摘要:
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)

浙公网安备 33010602011771号