This document explains how a do-while loop works by first executing the code block once before checking if the condition is true, then repeating the loop as long as the condition remains true. It provides an example of a do-while loop that prints out numbers from 20 to 25 using a variable i that is incremented each time through the loop and checks if i is less than or equal to 25.