use while to replace for