API Reference › Builtin functions › string
function

string

string(x) -> string

Converts a value to its textual form: an int, bool, or fixed becomes a string, and a value that is already a string is returned unchanged. This is what backtick {…} interpolation calls under the hood, so most of the time you can interpolate directly instead of calling string yourself. Reach for the explicit form when you need to store or pass around the text, or build a string in pieces. The result can be printed, drawn with Screen.draw_text, or concatenated.

Parameters

xthe value to convert to text

Example

program LabelValue {
  var score: int = 250

  handler ReportScore phase Start {
    let label = string(score)
    print(label)
  }
}
← All symbols