Create an iterator which, while a test condition is true, invokes a function for each iterated value before returning the iterated value.