Use While for pre-condition checks and Do While for at-least-once execution, and always guard both with a counter to prevent infinite loops.
The comprehensive walkthrough, production source code snippets, architectural state diagrams, and downloadable capstones for this topic are reserved exclusively for enrolled students of UiPath.