Original date:2019-06-17 14:21:35 Edited by: euphoric Subject: Re: Structs

Sometimes it might be convenient to "package" several related variables together into another. We call this a "variable structure," or "struct" for short.

You define a structure like this:

struct name 
   string first 
   string middle 
   string last 
end struct 
struct address 
   string street 
   string city 
   string state 
   string zip 
end struct 
struct employee 
   name name 
   address address 
end struct 

You instantiate a struct like other variable types:

name nName 
address nAddress 
employee nEmployee 

You assign values to a struct like this:

nName.first = "Billy" 
nName.middle = "Gene" 
nName.last = "Smith" 
nAddress.street = "1200 Independence Pkwy" = "New York City" 
nAddress.state = "New York" = "01234" = nName 
nEmployee.address = nAddress 
Not Categorized, Please Help


Quick Links

User menu

Not signed in.

Misc Menu