Skip to content

Numbers

Nubo supports integer and floating-point numbers, including prefixed number literals.

let dec = 1000
println(dec)
let flo = 1000.5
println(flo)

Use numeric prefixes for different bases:

let bin = 0b1010
let oct = 0o123
let hex = 0x1A
println(bin)
println(oct)
println(hex)

Use _ to make large numbers easier to read:

for i in 100_00 {
println(i)
}

Use standard arithmetic operators:

let sum = 0
sum = sum + 10
println(sum)

You can also combine arithmetic with function results:

import time from "@std/time"
const start = time.now()
const end = time.now()
println("Finished in", (end - start) / 1_000_000_000, "seconds")