Connection Information

To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.

Connection Type

Values for array elements – PB Docs 125 – PowerBuilder Library

Values for array elements – PB Docs 125

Values for array elements

General information

PowerBuilder initializes each
element of an array to the same default value as its underlying
datatype. For example, in a newly declared integer array:

the elements li_TaxCode[1], li_TaxCode[2],
and li_TaxCode[3] are
all initialized to zero.

For information about default values for basic
datatypes, see “Initial values for variables”.

Simple array

In a simple array, you can override the default values by
initializing the elements of the array when you declare the array.
You specify the values in a comma-separated list of values enclosed
in braces. You do not have to initialize all the elements of the
array, but you cannot initialize values in the middle or end without
initializing the first elements.

Multidimensional array

In a multidimensional array, you still provide the values
in a simple, comma–separated list. When the values are
assigned to array positions, the first dimension is the fastest-varying
dimension, and the last dimension is the slowest–varying.
In other words, the values are assigned to array positions by looping
over all the values of the first dimension for each value of the
second dimension, then looping over all the values of the second
dimension for each value of the third, and so on.

note.png Assigning values

You can assign values to an array after declaring it using
the same syntax of a list of values within braces:

Examples

Example 1

This statement declares an initialized one-dimensional array
of three variables:

Example 2

This statement initializes a two-dimensional array:

As a result:

  • Li_units[1,1], [1,2], [1,3],
    and [1,4] are all 1

  • Li_units[2,1], [2,2], [2,3],
    and [2,4] are all 2

  • Li_units[3,1], [3,2], [3,3],
    and [3,4] are all 3

Example 3

This statement initializes the first half of a 3-dimensional
array:

As a result:

  • Li_units[1,1,1], [1,2,1], [1,3,1],
    and [1,4,1] are all 1

  • Li_units[2,1,1], [2,2,1], [2,3,1],
    and [2,4,1] are all 2

  • Li_units[3,1,1], [3,2,1], [3,3,1],
    and [3,4,1] are all 3

  • Li_units[1,1,2], [1,2,2], [1,3,2],
    and [1,4,2] are all 0

  • Li_units[2,1,2], [2,2,2], [2,3,2],
    and [2,4,2] are all 0

  • Li_units[3,1,2], [3,2,2], [3,3,2],
    and [3,4,2] are all 0


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x