You could also use read which is more readable in my opinion:
function loop
echo $argv | read -l count command
for i in (seq 1 $count)
eval $command
end
end
This works better especially when you want to use more than the first argument.
echo $argv | read -l first second rest