Skip to content

Type Aliases

IsaacShelton edited this page Mar 21, 2022 · 1 revision

Type Aliases

Type aliases can be declared using the alias keyword with a name followed by an =, and a type.

alias MyTypeAlias = Type

Resolution

Type aliases are substituted out before any type checking is done. A consequence of this, is that type aliases are treated exactly the same as regular types

import basics

alias s64 = long

func sum(a, b long) long = a + b

func main {
    a s64 = 8
    b s64 = 13
    print(sum(a, b))
}
Clone this wiki locally