FILL - Fill STRING or ARRAY elements

Language reference ›› Built-in procedures ›› Miscellaneous variable treatments ››
Parent Previous Next

FILL(variable, value-expression) NEW! (V2.0)

Fill all elements of an array or string with the same value.


If <variable> is a string, <value-expression> is evaluated as CHAR, the length of the string is set to the maximum length of the string.


For filling with zero, the CLR procedure may be preferred.



VAR
 TheVal: INTEGER;
 TheIntBuf: ARRAY[1..5] OF INTEGER;
 TheRealBuf: ARRAY[1..4] OF REAL;
 TheStr: STRING[5];

 // Fill all the array with -12345
 TheVal := -12350;
 FILL(TheIntBuf, TheVal - 5);
 // Fill all the array with -123.45
 FILL(TheRealBuf, (TheVal - 5) / 100.0);
 // Fill the string with 5 dashes
 FILL(TheStr, '-');


See also: CLR.