-
-
Notifications
You must be signed in to change notification settings - Fork 9
Gives Operator
IsaacShelton edited this page Mar 21, 2022
·
1 revision
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)
}
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