by JBReefer · 10y ago · 0 comments
var myString = $@"
Hey, string interpolation is nifty.
Look ma, no { this.Hands.ToString().ToUpper() }
More text.
But this is a ""quote"". It's ""ugly"" isn't it?
";
As you can see, you need to double your double quotes to escape them. Almost perfect. You can even nest string interpolations to do next template stuff with functional-programming loops and whatnot. val str = s"""
Tripe quoted string interpolation
Allows for $variables and ${method.foo(bar)}
Mixed with "quotes"
"""
Can also use double quoted string interpolation for inline/one-liners where embedded quotes above aren't needed.