mirror of
https://github.com/KaiserY/trpl-zh-cn
synced 2025-02-24 21:32:15 +08:00
18 lines
305 B
Rust
Executable File
18 lines
305 B
Rust
Executable File
// ANCHOR: all
|
|
fn main() {
|
|
let width1 = 30;
|
|
let height1 = 50;
|
|
|
|
println!(
|
|
"The area of the rectangle is {} square pixels.",
|
|
area(width1, height1)
|
|
);
|
|
}
|
|
|
|
// ANCHOR: here
|
|
fn area(width: u32, height: u32) -> u32 {
|
|
// ANCHOR_END: here
|
|
width * height
|
|
}
|
|
// ANCHOR_END: all
|