Why do most rust tutorials push `println!("{} and {}", foo, bar)` instead of `println!("{foo} and {bar})`?
Python has f strings:
foo = "hello"
bar = "world"
print(f"{foo} {bar}!")
# hello world!
Javascript has this
const foo = "hello"
const bar = "world"
console.log(`${foo} ${bar}!`)
// hello world!
I was surprised to find out much later that Rust supports this feature too, but most tutorials or examples do not use it:
let foo = "hello";
let bar = "world";
println!("{} {}!", foo, bar);
// vs
println!("{foo} {bar}!");
Unless you're doing some kind of computation, seems like it is always more readable to insert your strings unless there is a reason I'm missing out why in rust should always default to putting everything at the end?
edit: yes I totally missed a quote in my title as 4D chess move to get more traffic ;)
edit: fixed examples, they were bad