destructure rover in function param list

This commit is contained in:
Daniel Barlow 2023-10-31 23:17:36 +00:00
parent 9348808ea9
commit 5a148a2688

View File

@ -8,11 +8,8 @@ mod rover {
type Rover = (i32, i32, Facing);
pub fn forward(r : Rover) -> Rover {
match r {
(lon, lat, direction) =>
(lon as i32, lat - 1 as i32, direction)
}
pub fn forward((lon, lat, direction) : Rover) -> Rover {
(lon as i32, lat - 1 as i32, direction)
}
}