πŸ“„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 main(): Unit {
  fmt.println("Hello World!")
}

Last updated