won't this run endless in case $num is not provided?