The issue you have has nothing to do with Robot Framework but your python code just doesnt work as you expected - as i tried to explain in the original code. Here's 100% python code that should visualize your issue and take my original answer into account:
def fun():
for i in range(100):
print(f"verify ${i=}")
if i % 2 == 0:
print(f"Before return of {i=} is even")
return True
print(f"After return of {i=} is even")
else:
print(f"Before return of {i=} is odd")
return False
print(f"After return of {i=} is odd")
print("This will never be printed because for look will 100% exit before code reaches here")
def even_more_fun():
results = []
for i in range(100):
print(f"verify ${i=}")
if i % 2 == 0:
print(f"Before return of {i=} is even")
results.append(True)
print(f"After return of {i=} is even")
else:
print(f"Before return of {i=} is odd")
results.append(False)
print(f"After return of {i=} is odd")
print("This will be printed because we went thru the whole loop but now, results for each value in your given range..")
return results
print("Calling fun() - see the output of your code")
result_of_fun = fun()
print("Calling even_more_fun() - see the output even more closely")
result_of_even_more_fun = even_more_fun()
print("And now we print the results")
print(f"{result_of_fun=}")
print(f"{result_of_even_more_fun=}")
Now, fun() gets called once.. It will return a single True value because 0 % 2 == 0 evaluates to True. Then your code will stop execution because you have a return state to return that value.
Next, even_more_fun() - it also gets called once but it will return a list of results for every item in your test data, which is range(100) in your case.
Copy that script to your machine and run it .. See the difference of outputs from fun() and even_more_fun().
This is how robot and python handles it (and any other sane programming language).
You either have the list of all values you want to test ON YOUR ROBOT CODE and you call fun() separately with each value OR you fix your python code and return a list of results for each value to make your code work and then return that list.