Formatting
To format a string is simple, you just need to prefix your "string" with a $. Like this: quot;string". Then you can use curly braces {} to insert as many expressions into your string as you would like.
Let us take a simple example for inserting a variable into a string.
insert_string := "world!"
final := quot;Hello {insert_string}"
// Prints "Hello world!"
print(final)
Any expression is allowed when formatting a string, like adding values, calling functions or even if expressions.
final := quot;Hello {if true { "world!" }}"
// Prints "Hello world!"
print(final)
Copy link
Edit on GitLab