Hello,
I need some help. I've not had much experience of implementing a record data structure in LiveCode and wondered how the following pseudocode would translate into LiveCode:
TYPE runner IS RECORD {STRING Participant, REAL Time, BOOLEAN Qualified}
SET race[0] TO {Participant = “Mark”, Time = 4.56, Qualified = False}
SET race[1] TO {Participant = “Greg”, Time = 4.32, Qualified = True}
SET race[2] TO {Participant = “Iain”, Time = 5.01, Qualified = False}
SET race[3] TO {Participant = “Peter”, Time = 4.61, Qualified = False}
SET race[4] TO {Participant = “Steve”, Time = 4.55, Qualified = True}
SET race[5] TO {Participant = “Ahmed”, Time = 5.12, Qualified = False}
Many thanks,
Steven
Using Records
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Re: Using Records
Hi Steven,
1. welcome to the forum!
2. No idea what a RECORD is, but this looks like a task for an Livecode ARRAY:
...
## No need to define a data type in LC!
put "Mark" into race[1]["Participant"]
put 4.56 into race[1]["time"]
put FALSE into race[1]["qualified"]
put "Greg" into race[2]["Participant"]
etc...
...
Address it like this:
put race[2]["time"] into fld "race 2 time"
You get the picture
Best
Klaus
1. welcome to the forum!

2. No idea what a RECORD is, but this looks like a task for an Livecode ARRAY:
...
## No need to define a data type in LC!
put "Mark" into race[1]["Participant"]
put 4.56 into race[1]["time"]
put FALSE into race[1]["qualified"]
put "Greg" into race[2]["Participant"]
etc...
...
Address it like this:
put race[2]["time"] into fld "race 2 time"
You get the picture

Best
Klaus
-
- Posts: 14
- Joined: Mon Jan 12, 2015 7:55 pm
Re: Using Records
Many thanks for your help with this Klaus. It worked perfectly! 
