Are you just asking what have_posts()
returns in this case?
It's not "a loopable function", it's just a function. There's nothing about it that indicates a loop. It's being used in this case as the condition for a loop:
while (have_posts())
The while
loop condition is expecting a boolean. Think of the statement as "while this condition is true, keep looping." So in this case have_posts()
should return a boolean, true or false.
As long as the function is returning true
the loop will continue. As soon as it returns false
the loop will end. The function itself has no internal knowledge of this. It's just being called over and over (each time the loop iterates).