Iterating over collection using match

This commit is contained in:
Stephan Rehfeld 2026-04-29 18:31:53 +02:00
parent bb45906753
commit 5daaf9e1bc

View File

@ -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"),
}
}
}