Strings

Strings in Risor are immutable sequences of characters. They can be created with double quotes or backtick template strings.

String Literals

Use double quotes for plain string literals:

let greeting = "hello"
let empty = ""

Template Strings

Backtick strings support embedded expressions using ${...} syntax:

let name = "World"
let greeting = `Hello ${name}!`

Any valid expression can appear inside the interpolation braces:

let result = `${1 + 2} items`          // "3 items"
let info = `Name: ${user.name}`
let calc = `Total: ${price * quantity}`

Template strings can span multiple lines:

let message = `
Hello ${name},
 
Welcome to Risor.
`

Indexing

Individual characters are accessed by index. Indices are zero-based:

let s = "hello"
s[0]     // "h"
s[4]     // "o"

Negative indices count from the end of the string:

let s = "hello"
s[-1]    // "o"
s[-2]    // "l"

Slicing

Extract a substring with slice syntax [start:end]. The start index is inclusive and the end index is exclusive:

let s = "hello"
s[1:3]   // "el"
s[:2]    // "he"
s[3:]    // "lo"

Omitting the start index defaults to 0. Omitting the end index defaults to the length of the string.

String Concatenation

Strings can be concatenated with the + operator:

let full = "hello" + " " + "world"   // "hello world"

For building strings from multiple values, template strings are usually more readable:

let full = `${first} ${last}`

Risor © 2026 Deep Noodle