For the complete documentation index, see llms.txt. This page is also available as Markdown.

🖼️Constants

You can only declare constants at the toplevel scope

Constant Declaration Syntax

[export] const <CONST_NAME_HERE> = <expr>

Working Example

package main

import "fmt" as fmt

const PI = 3.14
const MY_NAME = "Bob"

fun main(): Unit {
  fmt.println("My name is " + MY_NAME + ". And pi is approximately:")
  fmt.println(PI)
}
package main

import fmt "fmt"

const pI = 3.14
const mY_NAME = "Bob"

func main() {
	fmt.Println("My name is " + mY_NAME + ". And pi is approximately:")
	fmt.Println(pI)

}

Last updated