Not yet a struct but with structure
This commit is contained in:
parent
af84bc41e7
commit
c0630fde8c
@ -1,13 +1,12 @@
|
||||
fn main() {
|
||||
let width1 = 30;
|
||||
let height1 = 50;
|
||||
let rect1 = (30, 50);
|
||||
|
||||
println!(
|
||||
"The area of the rectangle is {} square pixels.",
|
||||
area(width1, height1)
|
||||
area(rect1)
|
||||
);
|
||||
}
|
||||
|
||||
fn area(width: u32, height: u32) -> u32 {
|
||||
width * height
|
||||
fn area(dimensions: (u32, u32)) -> u32 {
|
||||
dimensions.0 * dimensions.1
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user