Support > General Discussions

Script BASIC Arrays

(1/1)

Support:
One of my most favorite features of Script BASIC is its array (matrix) functionality. You don't have to define or dimension anything and there are no practical limits on indices. (associative, indexed or a combination of both)


--- Code: Script BASIC ---' Test  Associative Array by Index obj{"Name"}{"Value"} = undefobj{"Name"}{"Product"} = "ALL"obj{"Name"}{"Required"} = TRUEobj{"ID"}{"Value"} = undefobj{"ID"}{"Product"} = "SOME"obj{"ID"}{"Required"} = FALSE this{"Extension"}{"Value"} = "Default"this{"Extension"}{"Product"} = "FEW"this{"Extension"}{"Required"} = "MAYBE" obj{"Version"} = this{"Extension"} FOR o = 0 TO UBOUND(obj) STEP 2  PRINT obj[o],"\n"  FOR p = 0 TO UBOUND(obj[o + 1]) STEP 2    PRINT obj[o + 1, p]," - ",obj[o + 1, p + 1],"\n"  NEXTNEXT PRINT "-------------------------------","\n" PRINT obj[0],"\n"PRINT obj[1,0]," - ",obj[1,1],"\n"PRINT obj[1,2]," - ",obj[1,3],"\n"PRINT obj[1,4]," - ",obj[1,5],"\n"PRINT obj[2],"\n"PRINT obj[3,0]," - ",obj[3,1],"\n"PRINT obj[3,2]," - ",obj[3,3],"\n"PRINT obj[3,4]," - ",obj[3,5],"\n"PRINT obj[4],"\n"PRINT obj[5,0]," - ",obj[5,1],"\n"PRINT obj[5,2]," - ",obj[5,3],"\n"PRINT obj[5,4]," - ",obj[5,5],"\n"  PRINT "-------------------------------","\n" PRINT obj[2],"\n"FOR z = 0 TO UBOUND(obj{"ID"}) STEP 2  PRINT obj{"ID"}[z]," - ",obj{"ID"}[z + 1],"\n"NEXT 

Name
Value - undef
Product - ALL
Required - -1
ID
Value - undef
Product - SOME
Required - 0
Version
Value - Default
Product - FEW
Required - MAYBE
-------------------------------
Name
Value - undef
Product - ALL
Required - -1
ID
Value - undef
Product - SOME
Required - 0
Version
Value - Default
Product - FEW
Required - MAYBE
-------------------------------
ID
Value - undef
Product - SOME
Required - 0

Navigation

[0] Message Index

Go to full version