For and while loop, function call