MinIntValue
The MinIntValue function returns the smallest signed value in the integer data array aValues.
Please also refer to MaxIntValue for a similar function that returns the maximum value.
Declaration: Function MinIntValue(const aValues : array of Integer) : Integer
This function is illustrated two (2) ways below.
procedure
ScriptEvent (
var
Value : variant);
var
arrAges :
array
[
1..10
]
of
integer
;
iCount, MinCount :
integer
;
arrRandom :
array
[
1..10
]
of
integer
;
RandCount :
integer
;
begin
LogInfo(
'Counting up and writing ARRAY entries . . . '
);
iCount :=
1
;
FOR
iCount :=
1
to
10
do
begin
arrAges[iCount] := iCount *
2
;
LogInfo(
'Counter number = '
+IntToStr(iCount));
LogInfo(
'ARRAY number = '
+IntToStr(arrAges[iCount]));
LogInfo(
''
);
end
;
LogInfo(
''
);
LogInfo(
'MinIntValue the array . . . . '
);
MinCount := MinIntValue(arrAges);
//The smallest value number in the array
LogInfo(IntToStr(MinCount));
LogInfo(
''
);
LogInfo(
'Setting individual array values . . . . '
);
arrRandom[
1
] :=
2
;
arrRandom[
2
] :=
78
;
arrRandom[
3
] := -
34
;
arrRandom[
4
] :=
289
;
arrRandom[
5
] :=
945
;
arrRandom[
6
] :=
274
;
arrRandom[
7
] :=
4587
;
arrRandom[
8
] :=
47
;
arrRandom[
9
] :=
2189
;
arrRandom[
10
] := -
4588
;
LogInfo(
'MinIntValue the array . . . . '
);
RandCount := MinIntValue(arrRandom);
//The smallest value number at position 10 in the array
LogInfo(IntToStr(RandCount));
LogInfo(
''
);
LogInfo(
''
);
end
;
The resulting log follows.
