Num

object Num

Small numeric helpers for scripts. swc4j compiles to JVM bytecode, not a JS engine, so JS globals like parseFloat aren't guaranteed — use these to parse command arguments (which arrive as strings) into numbers.

Functions

Link copied to clipboard

Parse s as a number, returning 0 if it isn't one.

fun parse(s: String, fallback: Double): Double

Parse s as a number, returning fallback if it isn't one.