You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
IsaacShelton edited this page Mar 21, 2022
·
1 revision
Static Struct Literal
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.
Usage example
import basics
struct Person (firstname, lastname String)
func main {
person *Person = static Person("Isaac", "Shelton")
}