Imports and Modules
Modules organize code into reusable parts.
Creating a Module
Section titled “Creating a Module”math.nubo
:
fn add(a int, b int) -> int { return a + b}
fn subtract(a int, b int) -> int { return a - b}
Importing Modules
Section titled “Importing Modules”Import by module name or filename:
import math from "math"
println(math.add(1, 2)) // Outputs: 3
Using @std
Modules
Section titled “Using @std Modules”Standard modules start with @std/ and provide extra features, like:
io
json
log
math
thread