trpl-zh-cn/listings/ch05-using-structs-to-structure-related-data/listing-05-09/src/main.rs

13 lines
216 B
Rust

fn main() {
let rect1 = (30, 50);
println!(
"The area of the rectangle is {} square pixels.",
area(rect1)
);
}
fn area(dimensions: (u32, u32)) -> u32 {
dimensions.0 * dimensions.1
}