How to use "when" vs. "while" on the following occasions? [closed]

When I worked as a teacher, I met a good friend.

This sentence means, "During the time of my life when I worked as a teacher, I met a good friend."

While I was working as a teacher, I met a good friend.

This sentence means, "While I was on duty working as a teacher, I met a good friend."

The difference is that "when" is referring to a time or period of your life and "while" is referring to the act of working as a teacher. Both could be correct depending on context.


When I had a dream, I thought of the idea.

This sentence is rather meaningless. "When" doesn't really refer to a specific time or period and, therefore, isn't an appropriate use of the word.

While I was having a dream, I thought of the idea.

This sentence means, "While I was actively dreaming, I thought of the idea."

The difference between "when" and "while is the same as before. "When" should be used to refer to specific time periods or eras; "while" should be used to refer to a particular activity or behavior.