Gauntlet Documentation
  • 🏠Welcome
  • πŸ…Getting Started
    • 🧠Introduction To Gauntlet
  • ‼️Read before Proceeding
  • ⬇️Installation
  • πŸ‘¨β€πŸ’»VSCode Extension
  • πŸ“šBasics
    • πŸ’¨Running Gauntlet
    • πŸ“„File Setup & Hello World
  • πŸ” Scope Variables
  • πŸ–ΌοΈConstants
  • 🧩Functions
  • ↔️If Statements
  • πŸ”‘Ternary Operator
  • πŸ’ Switch-Case
  • πŸ“©Select-Case
  • ➰Loops
  • πŸ“Structs
  • 🧱Interfaces
  • πŸͺͺAliases
  • πŸ“ŽMethods
  • πŸ¦™Lambdas
  • πŸ•ΈοΈMiscellaneous
  • ⚑Advanced Features
    • πŸ”€When-Cases
    • 🚰Pipes
    • ⁉️Try-Statements
    • 🎭Force-Statements
    • 🌯Wrapper Types
Powered by GitBook
On this page
  • Constant Declaration Syntax
  • Working Example
Export as PDF

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 Unit main() {
  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)

}
My name is Bob. And pi is approximately:
3.14
PreviousScope VariablesNextFunctions

Last updated 4 days ago

πŸ–ΌοΈ