Page 1 of 1

User Defined Data Types

Posted: Sat Jan 14, 2012 2:23 am
by Bob Hays
Early versions of FNX basic had Type....End Type.

With Type...End Type I was able to create complex data types.
Also array of UDT`s were possible.

----------------
Type myTypet
? ?rname as string * 50
? ?raddr as string * 50
End Type

Dim myType(50) AS MyTypet
----------------------------------

Will these be brought back?

User Defined Data Types

Posted: Sat Jan 14, 2012 4:33 pm
by Marco
You can use record for it.
A record contains different variables;

record test
? ? d as integer
? ? f as string * 5
end record

there is also the type functio, i m busy with it right now.
best regards

User Defined Data Types

Posted: Sat Jan 14, 2012 6:42 pm
by Bob Hays
[quote author=3B3E3733345A0 link=1326507808/1#1 date=1326558816]You can use record for it.
A record contains different variables;

record test
? ? d as integer
? ? f as string * 5
end record

there is also the type functio, i m busy with it right now.
best regards[/quote]

How I create an array of record and access individual  records?

record test
    d as integer
    f as string * 5
end record

dim mytest(50) as test
mytest(1).d = 5

errors with `Invalid command mytest`

User Defined Data Types

Posted: Sun Jan 15, 2012 4:56 pm
by Marco
There is a bug with declaring the record, but if you declare the array as string it works.
you can put your data into the record and assign the record to the string array. It does not get a award but it must work that way.
In the future i shall improve it. So that the record arrays can be declared directly.

best regards


record drec
a as integer
b as string *5
end record

dim myrec(100) as string
``to write
drec.a=10
drec.b="test"
myrec(50)=drec
`erase
drec.a=0
drec.b=""
``read again
drec=myrec(50)
showmessage drec.b
showmessage drec.a