Constants

Constants define module-level values.

code
const answer = 42

Use pub const when another module should be able to use the value.

code
pub const version = "0.1.0"

Constants can include type annotations.

code
pub const pi: Float = 3.14
pub const default_port: Int = 1313
pub const site_name: String = "Donna"

Use constants for package metadata, defaults, and small values that should have one obvious home.

Use a function when the value needs arguments or real computation. Donna likes clarity. It is kind of her thing.