forum-msg-id-133968-edit

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" 
nAddress.city = "New York City" 
nAddress.state = "New York" 
nAddress.zip = "01234" 
 
nEmployee.name = nName 
nEmployee.address = nAddress 
Not Categorized, Please Help

Search



Quick Links

User menu

Not signed in.

Misc Menu