-
-
Notifications
You must be signed in to change notification settings - Fork 9
Static Struct Literal
IsaacShelton edited this page Mar 21, 2022
·
1 revision
Static struct literals can be used to create static constant global values of specific struct
type with fields specified. Their primary usage is static initialization.
They are declared with the static
keyword, followed by the name of a struct
type and then a list of field values in parentheses:
static Person ("John", "Smith", 32)
They return a pointer to the static constant global value that is created.
import basics
struct Person (firstname, lastname String)
func main {
person *Person = static Person("Isaac", "Shelton")
}