Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

String Interpolation

Sydrogen supports interpolation using the \V string form.

Example:

Int I = 42;

Print(\V"{I}");

The value of I is inserted into the string.

Multiple values can be used:

Int A = 10;
Int B = 20;

Print(\V"A = {A}, B = {B}");

Member access is also supported:

Ore(Int Age, Weld Name) Person = {14, "Den"};

Print(\V"{Person.Name} is {Person.Age}");

The interpolation form is recognized by the lexer through the \V prefix. Inside the string, expressions enclosed in { } are evaluated and rendered as their string representation.


← Previous Next →