From 5daaf9e1bcf10d7285f125bb34f951b6c25aa9da Mon Sep 17 00:00:00 2001 From: Stephan Rehfeld Date: Wed, 29 Apr 2026 18:31:53 +0200 Subject: [PATCH] Iterating over collection using match --- src/main.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main.rs b/src/main.rs index 478bb44..9305f32 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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"), + } + } }