mirror of https://github.com/KaiserY/trpl-zh-cn
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
305 B
18 lines
305 B
4 years ago
|
// 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
|