API Reference › Text › Text.from_int
method

Text.from_int

Text.from_int(n) -> string

Returns the decimal text of the integer n — Text.from_int(1234) is "1234", and negatives keep their sign. It is the same conversion as the bare string(n) and the inverse of Text.to_int. Use it when you need a number as characters — to measure its width, concatenate it, or store it — though drawing a number to the screen is better done with Screen.draw_number.

Parameters

nthe integer to render

Example

program ScoreLabel {
  var score: int = 1500

  handler Build phase Update {
    let label = Text.concat("score: ", Text.from_int(score))
  }
}
← All symbols