Tested on Lazarus, global integer variables that are not initialized have value = 0.
So that if-then always returns false true.
Sorry to be such a pita but a small correction (in basic you are correct):
for i:=1 to 5
do if h[i] > f then
begin
f:=h[i];
s:=i ;
end;
So on first iteration that statement holds while it doesn't for the follow up iterations (ofc depending on what values are stored inside h array).
@svy249:
using random(ize) can indeed sometimes mess with your expectations... in case you are unsure then simply write out the values so that you are able to see them.