User Defined Data Types

In this category you can exchange your programming questions and solutions.
Post Reply
Bob Hays
Posts: 26
Joined: Sun Oct 03, 2010 4:49 pm

User Defined Data Types

Post: # 812Post Bob Hays
Sat Jan 14, 2012 2:23 am

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?

Marco
Site Admin
Posts: 246
Joined: Sat Sep 15, 2018 8:41 pm

User Defined Data Types

Post: # 813Post Marco
Sat Jan 14, 2012 4:33 pm

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

Bob Hays
Posts: 26
Joined: Sun Oct 03, 2010 4:49 pm

User Defined Data Types

Post: # 814Post Bob Hays
Sat Jan 14, 2012 6:42 pm

[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`

Marco
Site Admin
Posts: 246
Joined: Sat Sep 15, 2018 8:41 pm

User Defined Data Types

Post: # 815Post Marco
Sun Jan 15, 2012 4:56 pm

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

Post Reply