Skip to content
Justice Tech School

String Interpolation

$name inserts a variable and ${expression} inserts any expression. Triple quotes span lines.

Example
var n = "Ada";
var a = 30;
print("$n is $a, next year ${a + 1}");
print("""
line1
line2""");

Exercise

Insert an expression.

"${a  1}"

Quiz Test

What do triple quotes allow?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.