Difference between revisions of "Control flow: Repeat actions"

(Created page with "<pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;"> This action can be used to repeat one or more other actions. It will repeat either...")
 
Line 1: Line 1:
 +
* '''''Fixed number'''''
 
<pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
 
<pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
This action can be used to repeat one or more other actions. It will repeat either a fixed number of times, or only while a certain condition is met.
+
Allows one or more actions to be repeated a fixed number of times.
 
+
Selecting this option allows the user to specify exactly how many times the actions should be performed within the loop.
In many cases it will be sensible to use a wait before next within the loop to prevent very rapid firing of lots of actions.
+
It is ideal for situations where a fixed number of iterations is required, ensuring precision and control in the execution of the macro.
 +
</pre>
 +
* ''''' While 'condition' '''''
 +
<pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
 +
Before executing any instruction inside the loop, the condition is first evaluated. If the condition is true, the code inside the loop is executed.
 +
This process of evaluating the condition and executing the code is repeated until the condition becomes false.
 +
If the condition is false from the start, the code inside the loop is not executed at all.
 +
</pre>
 +
* ''''' Do once and repeat while 'condition' '''''
 +
<pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
 +
In this type of loop, the actions inside the loop are executed once before the condition is evaluated for the first time.
 +
After this first execution, the condition is evaluated.
 +
If the condition is true, the loop repeats. If it is false, the loop terminates.
 +
The distinguishing feature here is that the code inside the loop is guaranteed to be executed at least once, regardless of the initial condition.
 
</pre>
 
</pre>

Revision as of 02:09, 13 February 2024

  • Fixed number
Allows one or more actions to be repeated a fixed number of times.
Selecting this option allows the user to specify exactly how many times the actions should be performed within the loop.
It is ideal for situations where a fixed number of iterations is required, ensuring precision and control in the execution of the macro.
  • While 'condition'
Before executing any instruction inside the loop, the condition is first evaluated. If the condition is true, the code inside the loop is executed.
This process of evaluating the condition and executing the code is repeated until the condition becomes false.
If the condition is false from the start, the code inside the loop is not executed at all.
  • Do once and repeat while 'condition'
In this type of loop, the actions inside the loop are executed once before the condition is evaluated for the first time.
After this first execution, the condition is evaluated.
If the condition is true, the loop repeats. If it is false, the loop terminates.
The distinguishing feature here is that the code inside the loop is guaranteed to be executed at least once, regardless of the initial condition.