Print
String Interpolation

String interpolation allows you to insert the value of almost any valid boo expression inside a string by quoting the expression with $().

The parentheses are unnecessary if the expression is just a variable:

String interpolation kicks in for both double and triple quoted strings:

You can scape the $ character to prevent interpolation:

You don't need to scape the $ char when it is followed by a space:

Interpolation doesn't kick in inside single quoted strings:

String Formatting

Boo also has the "%" (modulus) operator as shorthand for .NET/Mono's string.Format method. This is a little more similar to Python's string interpolation, too.

Combine boo and .net's string formatting

This tip suggested by Arron Washington. You can combine the two above techniques to get the best of both, like in this example:

Another way is to pass formatting codes to the ToString method:

Powered by Atlassian Confluence