Is it legit to do this:
Structure MyStruct
var1 as Single
var2 as Single
End Structure
Dim MyArray(1 to 3) of MyStruct
In other words can I have an array of structures?
Also, am I correct that I can do this? SysLib seems to say so:
"A variable that is a structure may be assigned to another variable that is the same type of structure using the standard assignment operator."
Dim A as MyStruct
Dim B as MyStruct
A.var1 = 0.0
A.var2 = 1.0
B = A '<==== CAN I DO THIS
Any enlightenment will be appreciated
Vic
Structure questions
Structure questions
Vic Fraenckel
KC2GUI
windswaytoo ATSIGN gmail DOT com
KC2GUI
windswaytoo ATSIGN gmail DOT com
Re: Structure questions
Yes. The structure members, however, need either Dim, Public or Private.victorf wrote:Is it legit to do this:Code: Select all
Structure MyStruct var1 as Single var2 as Single End Structure Dim MyArray(1 to 3) of MyStruct
Code: Select all
Structure MyStruct
Dim var1 as Single
Dim var2 as Single
End Structure
Yes. You can also check structure variables for equality/inequality using =/<> just like non-structure variables. One caveat, however, is that these operations on structures containing members that are allocated strings are either disallowed (for assignment) or result in a warning (comparison). Structure members that are bounded strings do not impose the same limitations.victorf wrote:Code: Select all
Dim A as MyStruct Dim B as MyStruct A.var1 = 0.0 A.var2 = 1.0 B = A '<==== CAN I DO THIS
- Don Kinzer