Search code examples
listpowerbuilder

What is the starting index of a List in PowerBuilder language?


Arrays in PB have a starting index of 1. So, do Lists also follow the same or are they different ?


Solution

  • PowerScript has no "List" datatype. You may implement it using an unbounded array. Default start index of arrays in PowerScript is 1. You may provide different values:

    string Department[10]        // Same array bounds
    string Department[1 TO 10]   // Same array bounds
    string Department[0 TO  9]   // Zero-based array
    string Department[-10 TO -1] // Negative indexes are valid
    string Department[-3 TO 6]   // "Mixed"  indexes are valid
    string Department[ ]         // Unbounded, always start at 1, dynamic size
    

    NOTE: Beware of performance using unbounded arrays!