Suppose I have the code
Do[If[f[i,j]==1,{output[i]=j,Break},Continue],{i,1,5},{j,1,1000}]
Where $f$ is just a function.
I want the code to find the first $j$ that works for $i$, then Break and then find the first $j$ that works for the next $i$, until a $j$ has been found for each $i$.
Instead what is happening is the code seems to go through all the $j$’s for each $i$ and then it remembers the last $j$ that works as output[i].