Write while loop