Hi--
I wish to translate a sequence of codes into corresponding mnemonics.
Two same-length properties encode the correspondence.
property Codes : {"9420", "94ae", "94d0", "942f", "942C", "9470"} property Mnemonics : {"RCL", "ENM", "ReW", "EOC", "EDM", "RfW"}
Eventually I expect the two lists to be much larger.
The following code works well enough...
on MnemonicOf(aCode) set Found to false repeat with k from 1 to the length of Codes if item k of Codes is equal to aCode then set ReturnResult to item k of Mnemonics set Found to true exit repeat end if end repeat if not Found...
...but is there another, perhaps faster, way to do this?
I think of constructs like...
if aCode is in Codes then...
...but I don't see how to index the Mnemonics list.
I think of maybe using records, but I don't see quite how.
Any suggestions?
--Gil
|