A do while loop in this situation is actually stupid. A for loop or while loop will suit this purpose better, since you do not need to make sure it executes at least once for the given condition. Do while loops are good for situations where the condition may not be true initially, and you'd like to guarantee execution at least once. E.g circular linked list node counter.