function SetVal(Value: Integer): TMtxVecInt;
Set all calling object elements to Value.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Value | Integer |
Result: stored in self (calling object), returns self for chaining
Examples
Uses MtxVecInt;
procedure Example;
var a: TVecInt;
begin
CreateIt(a);
try
a.SetIt([1,2,3,4]);
a.SetVal(5,2,2); // a = [1,1,5,5]
finally
FreeIt(a);
end
end;
Indexed: function SetVal(Value: Integer; Index: Integer; Len: Integer): TMtxVecInt;
Set all calling object elements [Index]..[Index+Len-1] to Value.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Value | Integer | |
| 2 | Index | Integer | start index |
| 3 | Len | Integer | element count |
Result: stored in self (calling object), returns self for chaining
Remarks:
An exception is raised if array borders are overrun/underrun.
Examples
Uses MtxVecInt;
procedure Example;
var a:TMtxInt;
begin
CreateIt(a);
try
a.SetIt(2,2,[1,2,3,4]);
a.SetVal(5,2,2); // a = [1,1,5,5]
finally
FreeIt(a);
end
end;