string interpolation

Building a string from a template whose placeholders hold expressions, which are evaluated and inserted as text.

In more detail

It is clearer than joining pieces with plus signs. The syntax varies: C# writes $"sku is {code}", while Terraform and JavaScript template literals use ${expression}. In Terraform, an interpolation that refers to a resource also creates a dependency on it.

Examples

Console.WriteLine($"Target framework: {target}");
greet = "hello ${var.name}"

Related terms

Taught in

References

Certification courses