Note that you can also pipe the output of a command into a loop:
command | while read
The problem is that this will run the loop in a subshell, so that if it modifies any variables, the changes will not stay once the loop exits. If that's a problem, you can use this instead:
done < <(command)
The <(command) syntax creates a named pipe, connects the command's output to it, and evaluates to the path to the named pipe.