When should whilst be used instead of while?
For example, should I use the first or the second sentence?
They don't do this whilst they do that.
They don't do this while they do that.
What would be correct?
I believe while and whilst are interchangeable, but whilst is more archaic and adds a nice flavoring to the sentence.
That being said, "whilst" doesn't seem to come up so often in the middle of a sentence as you had it there, so I would use "while" in that case, even though both are grammatically correct. Whilst seems more apt to be put at the beginnings of sentences, e.g.
"Whilst" and "while" are interchangeable. The difference between the two is "whilst" is British English and "while" is American English.
The two words 'while' and 'whilst' mean the same thing. They could be considered alternate pronunciations of the same word, similar to among/amongst or further/farther. 'While' came first, and then 'whilst' was derived from it.
But they are not used with the same frequency and they give different 'feels'. 'While' is much more common (from Google nGrams)
'Whilst' sounds archaic, affected, or hyperacademic (which means no one in academia uses it).
To Americans, 'whilst' sounds British, but at least in print, there is very little difference in the frequencies of the two words between AmE and BrE (via Google nGrams)
In the end, it is correct grammar to use them interchangeably, but it is bad style...uh sorry, not the current fashion to use 'whilst'. No one (at least not in formal writing, like for newspapers or academic writing) uses 'whilst' anymore. It may be common and accepted in certain varieties of English (say Indian English) but is very jarring in standard English.
However, in the 18th century the two were on more equal terms. The classic study of text analysis by Mosteller and Wallace to help discover the authorship of the Federalist papers was based primarily on the use of differentiating pairs like this.