Standard methods
A bunch of useful standard methods!
print(args...)
andprintln(args...)
writes to standard outputlen()
returns length of a measurable element (String, Array or Unit)sleep(millis: Int)
rand(from: Int, to: Int): Int
int(Char or String or Float)
converts into an int typeexit(exitCode: Int)
float(Int or Char or String): Float
bool(String): Bool
time(): Int
time (in millis) since program startedread(): String
andreadln(): String
reads from standard inputformat(String, Format Args...): String
formats a string with values provided, equal toString.format()
of JavatypeOf(Any Element): Type
returns type signature of an elementcopy(Any Element): Any
duplicates the element (primitives only!)memclear()
experimental method to clear all the memory space
Useful snippets
Formating a string with args
let name = "Melon"
println( format("Hello %s!", name) )
// prints "Hello Melon!"
format()
method is the exact same as String.format()
! That's what's called under the hood.
println(typeOf("Melon") == type::String) // true
println(typeOf(arrayOf(5, 2)) == type::Array<Int>) // true