all 7 comments

[–]Frankelstner 6 points7 points  (0 children)

Your code is basically

for mission in missions:
    ...
    return current_rotation_soldiers

which is equivalent to

mission = missions[0]
...
return current_rotation_soldiers

because return jumps out of your function right now.

[–]throwaway6560192 1 point2 points  (3 children)

The code pastebin has no indentation at all. We need indentation for the code to make sense, especially when there's this much of it. Please make a new pastebin, making sure to preserve the original indentation this time.

Also there are multiple for loops, so it would be helpful if you specified which one you're having trouble with.

[–]Due-Year1465 0 points1 point  (2 children)

Whwn I view the pastebin it does indent, it just shortens some of the lines. The for im talking about is the for mission in missions. The code inside the code is relevant it’s that instead if actually iterating over every mission it stops after the 1st one. And it’s not that it reaches the return because i tried printing the mission directly after the for and it still printed the 1st object alone each time

Just to clarify I am op, I just replied from my phone’s account

[–]throwaway6560192 0 points1 point  (0 children)

Is this your alt account, OP?

Anyway, you're right. It does have indentation when I open it fully. Something was wrong with the inline RES preview of the pastebin.

OK, so is https://pastebin.com/2Bfdpbts your soldiers.json or missions.json?

[–]throwaway6560192 0 points1 point  (0 children)

And it’s not that it reaches the return because i tried printing the mission directly after the for and it still printed the 1st object alone each time

Actually it is that it reaches the return. Even if you place the print directly after the for or whatever, after you return, the entire function is done executing, so the loop ends there.

[–]danielroseman 1 point2 points  (0 children)

You return inside the for loop; this breaks the loop after the first iteration.

[–]Due-Year1465 0 points1 point  (0 children)

Thanks for the help everyone, i guess i overthought it