This happens to me at least one out of every five exercises, so I looked through to see if his happening to anyone else.
It is not an error, but a lack of safe guards. Example, I wrote out code then my int conx went out b4 I could run and I went back to an empty console.
This is just one of many ways in which I loose code.
Also when the browser kicks me back accidentally, which is a stupid glitch in the browsers, but still. CA should be saving the code as we go so that it does not get erased. No matter how we leave a page.