We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
A do{} while() can always be rewritten to while() do{}. Since whatever is contained in the loop body can always be encapsulated into a routine, do{} while() has never been really popular among professional developers in day-to-day work. To me, personally, I find while() do{} having a condition upfront is clearer and less error prone, therefore is a better practice even with more lines of code, but that's all subjective anyway.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Linked Lists: Detect a Cycle
You are viewing a single comment's thread. Return to all comments →
A do{} while() can always be rewritten to while() do{}. Since whatever is contained in the loop body can always be encapsulated into a routine, do{} while() has never been really popular among professional developers in day-to-day work. To me, personally, I find while() do{} having a condition upfront is clearer and less error prone, therefore is a better practice even with more lines of code, but that's all subjective anyway.