10.2) Loops

Loops are repetitions of a set of operations based on a given condition. In UiPath, the most important loops are:

  • Do while: 

                It executes a specific sequence while a condition is met. The condition is evaluated after each                     execution of the statements.

                 For example, a robot could perform a refresh command over a website and then check if a                         relevant element was loaded. It will continue the refresh - check cycle until the element is                             loaded. 

  • While:

            It executes a specific sequence while a condition is met. The condition is evaluated before each                 execution of the statements.

 

            In many cases, it is interchangeable with Do While, the only difference being when                                 the condition verification is made. But in some cases, one is preferable over the other. For                         example, if a Robot would play Blackjack, it should calculate the hand before deciding whether             to draw another card.

  • For Each

           It performs an activity or a series of activities on each element of a collection.

 

            This is very useful in data processing. Consider an Array of integers. For Each would enable the             robot to check whether each numeric item fulfills a certain condition.


Where Loops can be used: Examples

  • Checking list of emails for attachments
  • Extracting information from list of invoices
  • Transferring a set of customer profiles from excel to CRM application


No comments:

Post a Comment

Sequence and Flowcharts

  UiPath recommends that the first part of the Robot should start with Flowchart or Sequence. We can nest Sequence inside Sequence, Flowchar...