Runtime Array Bounds

For PowerBuilder .NET targets, the PowerScript language allows you to declare an unbounded array at design time, and to dynamically create the array bounds at runtime.

Note: Although you could create and use an unbounded one-dimensional array in earlier versions of PowerBuilder, you could not set bounds for these arrays at runtime.

PowerScript lets you specify array bounds for one-dimensional or multidimensional unbounded arrays. The array bounds are created at runtime.

This example sets the indexes for an unbounded one-dimensional array to 2, 3, 4, and 5:
        int arr[] //one-dimensional unbounded integer array
        arr = create int[2 to 5]
This example sets the indexes of an unbounded two-dimensional array to 4 for one dimension, and 2, 3, 4, and 5 for the other dimension:
        int arr[,] //two-dimensional unbounded integer array
        arr = create int[4, 2 to 5]

Although you can set runtime bounds for unbounded arrays, you cannot reset design-time array bounds at runtime. For example, this code produces an error:

        int a[3]
        a = create int[5] //ERROR

Other useful array rules