While as a conjunction
As a conjunction while means ‘during the time that’, ‘for as long as’, ‘at the same time as’ and similar ideas.
While there is life, there is hope.
While he was in London he studied music.
While they were watching TV somebody broke into the house.
Note that while is usually used for the longer background action or situation.
While can also mean ‘although’.
While I admire your courage, I think that you should not go on this dangerous journey.
While clauses can go at the beginning or end of sentences.
Somebody broke into the house while they were watching TV.
While I was working you were playing.
You were playing while I was working.
While can be used to say that two longer actions or situations go / went on at the same time. Both continuous and simple tenses can be used.
While you were watching TV, I was working.
While John washed the clothes, Alice cooked dinner.
It is often possible to leave out subject + be after while.
While in London, he studied music. (= While he was in London, he studied music.)
While in Rome, do as Romans do. (While you are in Rome, do as Romans do.)