He specifically said “while” not “for” loops. Also putting returns
inside a for loop would just return the value being returned (that is if it’s within scope of a function), like:
local function get()
for _, value in ipairs(someDict) do
if value == 1 then
return -1
end
end
return 0
end
print(get({0, 3, 2, 1)) -- returns -1
print(get({1, 1, 3, 5}) -- returns 0