Strings and interpolation

Strings use double quotes and are immutable UTF-8 values. Familiar escapes include \n, \t, \r, \\, and \". Interpolate one name with $name or any expression with ${...}.

Use \$ when a dollar sign is literal. Numeric and boolean interpolation converts the value to text; it does not change the value's type elsewhere.

fn main() {
  let name = "moon"
  let age = 1
  println("Hello $name")
  println("Next: ${age + 1}")
  println("Price: \$5")
}
Output & diagnostics
Expected:
Hello moon
Next: 2
Price: $5
Ctrl/⌘+Enter runs the current lesson.