use 'while()' in code + test