We use 'while' to talk about two things happening together. It shows that one action happens during another action.
I listen to music while I cook dinner.
She reads a book while waiting.
'While' as a noun means a short time. We often say 'for a while' to mean some time but not long.
Stay here for a while, please.
It took a while to finish work.
We use 'while' to show a difference between two things. It means 'but' or 'although' in sentences.
While she likes tea, I prefer coffee.
He is tall while his brother is short.
In older or literary English, 'while' is a verb meaning to spend time doing something pleasant or relaxed. It is not common in daily speech.
They whiled away the afternoon by chatting.
We whiled the hours watching old films.
'A while ago' is an expression to say something happened some time in the past, but not exactly when.
She left a while ago.
I saw him a while ago outside.
'While away' means to spend time doing something fun or relaxing. It is a commonly used phrase for leisure time.
We whiled away the evening with music.
They while away their days at the beach.