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
  • Alias Syntax
  • Working Example
Export as PDF

Aliases

Alias Syntax

alias <AliasName> = <Type>

Working Example

package main

import "fmt" as fmt

alias Name = String

fun String getGreeting(Name name) {
  return "Hello, " + name + "!"
}

fun Unit main() {
  let myGreeting = getGreeting("Bob")
  fmt.println(myGreeting)
}
package main

import fmt "fmt"

type name = string

func getGreeting(name name) string {

	return "Hello, " + name + "!"

}

func main() {
	myGreeting := getGreeting("Bob")
	fmt.Println(myGreeting)
	// Eliminates any 'unused variable' errors
	_ = myGreeting

}
Hello, Bob!
PreviousInterfacesNextMethods

Last updated 4 days ago

πŸͺͺ