Skip to content

Integer Prototypes

Integer values expose mutation helpers.

let count = 1
count.increment()
println(count)

Prototype calls currently work reliably on values stored in variables.

let s = "string"
println(s.length())

Calling prototype methods directly on literals is currently limited by AST/parser behavior.

// Currently may not work:
println("string".length())

Prefer assigning the literal to a variable first.

let text = "string"
println(text.length())
MethodReturnsDescription
increment()voidIncrements the integer by 1.
decrement()voidDecrements the integer by 1.
let count = 0
count.increment()
count.increment()
count.decrement()
println(count)