Skip to content

04 String interpolation ​

Use ${expression} to place a typed expression inside a string.

norm
main() {
  String name = "Norm"
  Integer completed = 3

  String message = "Hello, ${name}"
  String progress = "Completed ${completed} tasks"

  printLine(message)
  printLine(progress)
}

Output:

text
Hello, Norm
Completed 3 tasks

The braces evaluate name or completed where the string is built. The source remains one String expression, and the embedded value is converted for display. Interpolation does not change the type of completed.

Try it: Try ${completed + 1} and compare the output.

Precise rules: Language Reference.

Norm 0.25