Challenge 2: A print_all! Macro — Possible Solution ==================================================================== macro_rules! print_all { ( $($x:expr),* ) => { $( println!("{}", $x); )* }; } fn main() { print_all!(1, "hello", 3.14); } // Output: // 1 // hello // 3.14 WHY THIS WORKS AS AN ANSWER ------------------------------ The pattern $($x:expr),* matches ANY number of comma-separated expressions — zero, one, or many — directly reusing this chapter's own my_vec! repetition pattern rather than inventing a new mechanism. The expansion $( println!("{}", $x); )* repeats the println! statement ONCE PER captured expression, substituting each one in turn — this is the same repetition-on-both-sides relationship this chapter's my_vec! example demonstrated (one $(...)* on the pattern side capturing multiple items, matched by a corresponding $(...)* on the expansion side emitting one statement per captured item). Calling print_all!(1, "hello", 3.14) expands into three separate println! statements — println!("{}", 1); println!("{}", "hello"); println!("{}", 3.14); — one per argument, each on its own line exactly as required. Because $x:expr accepts expressions of ANY type (not just one specific type), mixing an integer, a string literal, and a float in the same call works without any special handling — each expands into its own independent println! call, and Rust's own {} formatting handles each type appropriately at that call site.