String interpolation / template literals like JS?

He is saying that you can’t do something like,

let x = Y { 10, 20, 30 };

but you can do

println!("{}{}{}", 10, 20, 30);
3 Likes

But wouldn’t a better comparison be with println!("{a}{b}{c}", ...)?

Which you can do, but you have to then write println!("{a}{b}{c}", a=a, b=b, c=c);. You can’t just write println!("{a}{b}{c}", a, b, c);.

In theory we could allow that, but we don’t today.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.