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
  • Starting a File
  • Importing and Using Modules
  • The "main" Function
  • Working Hello World Example
Export as PDF
  1. Basics

File Setup & Hello World

Starting a File

Gauntlet mirrors Go's package-based compilation model. As such, every file must start with package <name>.

Importing and Using Modules

Gauntlet's import syntax is:

import "<modulename>" as <aliasname>

It is required that you give an alias to every module you import.

Once you have imported it, you can use it like you normally would in Golang.

If you imported fmt as such:

import "fmt" as fmt

Then you must access it using whatever is on the right side of the "as" keyword (fmt):

fmt.println("Hello World!")

The "main" Function

Functions are explained in more detail later

The main function is the entry point of every Gauntlet program; it is not required in every file. It must have a return type of Unit.

Working Hello World Example

package main

import "fmt" as fmt

fun Unit main() {
  fmt.println("Hello World!")
}
package main

import fmt "fmt"

func main() {
	fmt.Println("Hello World!")
}
Hello World!

PreviousRunning GauntletNextScope Variables

Last updated 6 days ago

πŸ“š
πŸ“„