Type                                                                                                       Statement

 

TYPE userName

 

Description

To begin the definition of a user-defined definition of a data type or structure.

 

Example

Type PersonType

  Name as string

  Occupation as string

  Salary as double

End Type

 

Dim person as PersonType

Person.name="John Doe"

Person.Occupation="Freelance artist"

Person.Salary=50000.00

msgbox "The person's name is " + person.name

msgbox "The person's occupation is " + person.occupation

msgbox "The person's slary is " + str(person.salary)

 

There may also be arrays of the user-defined type.

Dim workers(100) as PersonType

Sum=0

For I=1 to noWorkers

  Sum=Sum + workers.salary(i)

Next

Avg=sum / noWorkers