Skip to content

Gives Operator

IsaacShelton edited this page Mar 21, 2022 · 1 revision

~> Operator

The ~> operator can be used after a call to specify the return type. This is used when multiple functions have the same name and arguments, but have different return types.

import basics

func getMessage() String {
    return "Hello World!"
}

func getMessage() *ubyte {
    return 'Bye World!'
}

func main {
    printf("%S\n%s\n", getMessage() ~> String, getMessage() ~> *ubyte)
}

Common Usage

The most common usage of the ~> operator, is when manually invoking the special function __as__.

__as__(from) ~> ToType

See user-defined casts for more information

Clone this wiki locally