Solution Review 2: Display Output Using Placeholders
This lesson gives a detailed solution review of the challenge in the previous lesson.
We'll cover the following...
Solution:
Press + to interact
fn test() {println!("{}", 1);println!("{}{}", 2, 2);println!("{}{}{}", 3, 3, 3);println!("{}{}{}{}", 4, 4, 4, 4);println!("{}{}{}{}{}", 5, 5, 5, 5, 5);}
Explanation
-
On line 2,
println!
takes a placeholder{}
and 1. -
On line 3, ...