Iterating over collection using match
This commit is contained in:
parent
bb45906753
commit
5daaf9e1bc
@ -135,4 +135,11 @@ fn main() {
|
||||
v.push(Geometry::Plane(plane1));
|
||||
v.push(Geometry::Sphere(sphere2));
|
||||
v.push(Geometry::Sphere(sphere3));
|
||||
|
||||
for geo in v {
|
||||
match geo {
|
||||
Geometry::Sphere(s) => println!("A Sphere"),
|
||||
Geometry::Plane(p) => println!("A Plane"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user