Make sure to initialize the temporary state variable for while loops.