Errors that occur when addressing arrays
Fixed-size arrays
In PowerBuilder, referring to array elements outside the declared
size causes an error at runtime; for example:
|
1 |
int test[10] |
|
1 |
test[11]=50    // This causes an execution error. |
|
1 |
test[0]=50     // This causes an execution error. |
|
1 |
int trial[5,10] |
|
1 |
trial [6,2]=75  // This causes an execution error. |
|
1 |
trial [4,11]=75  // This causes an execution error. |
Variable-size arrays
Assigning a value to an element of a variable-size array that
is outside its current values increases the array’s size.
However, accessing a variable-size array above its largest assigned
value or below its lower bound causes an error at runtime:
|
1 |
integer li_stock[ ] |
|
1 |
li_stock[50]=200 |
|
1 |
// Establish array size 50 elements. |
|
1 |
IF li_stock[51]=0 then Beep(1) |
|
1 |
// This causes an execution error. |
|
1 |
IF li_stock[0]=0 then Beep(1) |
|
1 |
// This causes an execution error. |
Document get from Powerbuilder help
Thank you for watching.
Subscribe
Login
0 Comments
Oldest