code independent from /az option (0-based arrays)
Posted: Fri Aug 12, 2016 3:40 am
The best option to write code independent from the /az compiler option (use 0-based arrays) is to use foreach:
but if you cannot for some reason, the following code works:
Code: Select all
local aData as string[]
aData := <string>{ "one", "two", "three", "four", "five", "six", "seven" }
foreach cString as string in aData
System.Console.WriteLine( String.Format( "member is {0}", cString ) )
next
but if you cannot for some reason, the following code works:
Code: Select all
local aData as string[]
local nLen as int
local nI as int
aData := <string>{ "one", "two", "three", "four", "five", "six", "seven" }
nLen := aData:Length - 1 + __ARRAYBASE__
for nI := ( 0 + __ARRAYBASE__ ) upto nLen
System.Console.WriteLine( String.Format( "member {0} is {1}", nI:ToString(), aData[nI] ) )
next