Literals syntax

String interpolation

$name and ${expr} inside string literals.

Simple $identifier and ${expression} forms lower to Java string concatenation. Escape a literal dollar with \$. Use ${...} for member access or complex expressions.

Affogato

example.aff
let name = "Alex"
let count = 3
println("Hello ${name}, count $count")
println("Price: \$9.99")

Generated Java

Example.java
final String name = "Alex";
final int count = 3;
System.out.println("Hello " + name + ", count " + count);
System.out.println("Price: $9.99");

See also

← All keywords