The ScriptBasic
REF statement allows for building complex variable structures in a more nature
Basic way.
REF customer = addr
REF customer = phone
REF customer = bal
customer{"id"} = 1
addr{"name"} = "John Doe"
addr{"street"} = "Main St."
addr{"city"} = "Anytown"
addr{"state"} = "Unknown"
phone{"work"} = "800-555-1234"
phone{"home"} = "888-4444"
bal[30] = 100
bal[60] = 250
bal[90] = 0
PRINT customer{"id"},"\n"
PRINT customer{"name"},"\n"
PRINT customer{"street"},"\n"
PRINT customer{"city"},"\n"
PRINT customer{"state"},"\n"
PRINT customer{"work"},"\n"
PRINT customer{"home"},"\n"
PRINT customer[30],"\n"
PRINT customer[60],"\n"
PRINT customer[90],"\n"
C:\scriptbasic\test>reftest
1
John Doe
Main St.
Anytown
Unknown
800-555-1234
888-4444
100
250
0
REFArray Mix ModeAnother example of accessing an associative array.
addr{"name"} = "John Doe"
addr{"street"} = "Main St."
addr{"city"} = "Anytown"
addr{"state"} = "Unknown"
FOR x = LBOUND(addr) TO UBOUND(addr)STEP 2
PRINT addr[x],"=",addr{addr[x]},"\n"
NEXT x
C:\scriptbasic\test>aatest
name=John Doe
street=Main St.
city=Anytown
state=Unknown