Takes at most num inputs.
num
Take exactly num inputs, ensuring condition holds.
condition
Takes at most num inputs as long as condition holds.