If inside For - Part not working for higher iterations

Bonjour,

 sup = s[[1]];
For[j = 2, j <= n, j++,
  If [s[[j]] >= sup, sup = s[[j]], sup = sup];
  ];

i don’t know why this function If doesn’t give me the high number of list s ?
it give me always the number s[[1]].
please if there any response for this problem.

thank you

x

In[1]:= s = RandomReal[{0, 1}, 6]

Out[1]= {0.0983261, 0.814716, 0.152864, 0.588498, 0.39265, 0.60135}

In[2]:= sup = s[[1]];
For[j = 2, j <= n, j++, If[s[[j]] >= sup, sup = s[[j]]];];

In[4]:= sup

Out[4]= 0.0983261

In[5]:= sup = s[[1]];
n = Length[s];
For[j = 2, j <= n, j++, If[s[[j]] >= sup, sup = s[[j]]];];

In[8]:= sup

Out[8]= 0.814716