Question: letting maple determine the number of iterations are needed

how to forcely or better say conditionally stop a "for" loop at a specific reached value without completing the rest of the loop, in other words I have such loop : for i from 0 to 100 do x[i+1]=f(x[i]) end do , I want this loop to stop at i where x[i+1]=x[i] (the fixed point) this can be at i=40 (for example) then I dont need to complete the iteration until i=100, which means how to let maple determine the number of iterations needed. and I need : if x[i+1]=x[i] k:= i: g:=x[i] to use these valuse later on in the program. if I somehow can stop the loop at i where x[i+1]=x[i] then I will absolutely not need the if statement. Can you please tell me how to perform this task? Thanks in advance
Please Wait...