Sets a specified value at a specific position of a list.
List.bdh
ListSetAt( in theList: list, in index: number, in val: union) : boolean;
Parameter | Description |
---|---|
theList | List of number, boolean, float or string. |
index | Position of theList at which to replace the value. |
val | Number, boolean, float or string value to replace at index. Has to conform with the type of theList. |
transaction TAListSetAt var lstNumber: list of number init 1, 2, 3, 4, 5; retVal1, retVal2: boolean; nr: number; begin retVal1 := ListSetAt(lstNumber, 3, 333); retVal2 := ListGetAt(lstNumber, 3, nr); if(retVal1 = true) and (retVal2 = true) then writeln("element at position 3: " + string(nr)); else writeln("ListSetAt or ListGetAt did not work!"); end; end TAListSetAt;
element at position 3: 333