While as a conjunction and adverb
When used as conjunction/adverb, both the words mean during or at the same time as. They can also mean whereas (in the context of comparison). In the above sentence, we can replace ‘whereas’ with while or whilst and both will be correct.
While and whilst are same in meaning when used as a conjunction/adverb.
Meanwhile – meanwhile indicates between a time period. For example, you are waiting for a bus. During that time, you talk to your mother on phone, while waiting for the bus. This gap is indicated with the word meanwhile.
Note that in all the sentences, we can replace meanwhile and use while. ‘While’ will then join the 2 sentences and make it one. For example, “Finish your homework while I prepare nice dinner for you”, or “While we were talking nicely, our teacher came and scolded us for not doing the class work.”
While as a noun
As a noun, while is used to indicate a period of time.
Notice the use of ‘a’ in every sentence when we use while to indicate a time-period.
While as a verb
As a verb, while is used to indicate passing time or spending time on things just for the sake of it.
Note that we use ‘away’ along with while.
While as a preposition
Though while is rarely used as a preposition, it is not incorrect. It has the meaning ‘until’. For example,
As we have seen, while is used in many contexts. However, whilst can be used only as adverb or conjunction. While is more common and you should prefer using while over whilst whenever you are in doubt.