Describe Loops Structure and Conditions

  1. Home
  2. Describe Loops Structure and Conditions

The visual Basic loops structure allow you to run one or more lines of code repetitively. Such that, we can repeat the statements in a loop structure until a condition is True until a condition is False, a specified number of times, or once for each element in a collection. We have shared illustration shows a loop structure that runs a set of statements until a condition becomes true –

Flow chart that shows a Do...Until loop.
Source: Microsoft

While Loops

The WhileEnd While construction loop runs a set of statements as long as the condition specified in the While statement is True. It runs a series of statements as long as a given condition is True.

Do Loops

The DoLoop construction loop allows you to test a condition at either the beginning or the end of a loop structure. You can also specify whether to repeat the loop while the condition remains True or until it becomes True. It repeats a block of statements while a Boolean condition is True or until the condition becomes True.

For Loops

The ForNext construction loop performs the loop a set number of times. It uses a loop control variable, also called a counter, to keep track of the repetitions. We specify the starting and ending values for this counter, and you can optionally specify the amount by which it increases from one repetition to the next. It repeats a group of statements a specified number of times.

For Each Loops

The For EachNext construction loop runs a set of statements once for each element in a collection. You specify the loop control variable, but you do not have to determine starting or ending values for it. It repeats a group of statements for each element in a collection.

Microsoft Exam PL-900 Free Practice Test

Learn to use the apply to each action in Power Automate 

There are various triggers that can immediately start a cloud flow based on an event. But there are times when we want to run a cloud flow that queries a data source on a predefined schedule, taking certain actions based on the properties of the items in the data source. Therefore, the flow can be started on a schedule and use a loop action such as Apply to each to process a list of items. 

Prerequisites to apply to each action
  • Firstly, an account that’s registered to use Power Automate.
  • Secondly, an Office 365 Outlook account.
  • Thirdly, the Power Automate mobile app for Android, iOS, or Windows Phone.
  • Lastly, connections to Office 365 Outlook and the push notification service.

Following illustrate a table describing the flow to execute apply to each using illustration –

overview of the flow being built
Source: Microsoft
Microsoft Exam PL-900 Free Practice Test
Menu