box-o-sand/rustbook/rectangles/src/main.rs

13 lines
216 B
Rust
Raw Normal View History

2017-12-31 03:09:26 +00:00
fn main() {
2017-12-31 15:01:00 +00:00
let rect1 = (30, 50);
2017-12-31 03:09:26 +00:00
println!(
"The area of the rectangle is {} square pixels.",
2017-12-31 15:01:00 +00:00
area(rect1)
2017-12-31 03:09:26 +00:00
);
}
2017-12-31 15:01:00 +00:00
fn area(dimensions: (u32, u32)) -> u32 {
dimensions.0 * dimensions.1
2017-12-31 03:09:26 +00:00
}