I´m coming from the Sinclair Spectrum Basic and I use arrays for everything.
I discovered something interesting in clarity that is "Type".
Instead of Array (1 to 3) I could use:
Array.ThingA; Array.ThingB and Array.ThingC
What about if I need Array (1 to 2, 1 to 2)?
Exist something that allow me to use things like:
Array.ThingA.Piece1; Array.ThingA.Piece2; Array.ThingB.Piece1 and Array.ThingB.Piece2?
Thanks.
Exist a Type for more than one variable?
-
- Posts: 375
- Joined: Mar 15, 2015 12:41
-
- Posts: 375
- Joined: Mar 15, 2015 12:41
Re: Exist a Type for more than one variable?
This is the best I could do.
Exists something better?
Exists something better?
Code: Select all
Type ListaMovidas
Desde As Integer
Hacia As Integer
Tipo As Integer
Corona As Integer
AlPaso As Integer
ValorOrden As Integer
End Type
Dim Shared LM(1 To 100,1 To 500) As ListaMovidas
Dim As Integer Profundidad, Movida
Profundidad=5
Movida=23
LM(Profundidad, Movida).Hacia=3
Print LM(Profundidad, Movida).Hacia
Sleep
Re: Exist a Type for more than one variable?
Types can be nested.
Code: Select all
type typethingA
piece1 as Integer
piece2 as integer
end type
type typethingb
piece1 as integer
piece2 as integer
end type
type typearray
thingA as typethingA
thingB as typethingB
end type
dim as typearray array(5)
array(1).thingA.piece1=10
array(4).thingB.piece2=15
print array(1).thingA.piece1
print array(4).thingB.piece2
sleep
-
- Posts: 375
- Joined: Mar 15, 2015 12:41
Re: Exist a Type for more than one variable?
Nice! Thanks SARG! :-)SARG wrote:Types can be nested.
Code: Select all
type typethingA piece1 as Integer piece2 as integer end type type typethingb piece1 as integer piece2 as integer end type type typearray thingA as typethingA thingB as typethingB end type dim as typearray array(5) array(1).thingA.piece1=10 array(4).thingB.piece2=15 print array(1).thingA.piece1 print array(4).thingB.piece2 sleep