When to use When

<p>Hey guys, i was going through a few practice tests and i realized there was only one major thing i wasn't mechanically comfortable with: the word when. Usually i go by feeling, but i want to know when a sentence is incorrectly using it. The definition i've been going by is "if it's related to time, when is fine."</p>

<p>but how about something like:
When i was walking, i waved to Emily.
or
While i was walking, i waved to Emily. -- which is correct if on a test?</p>

<p>Thanks to any replies, basically i just want a few examples of "when" being used incorrectly in context. Its killer to search for "when not to use when".</p>

<p>bump.......</p>