{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":22412,"path":"integrate-applications/use-loops-while.md","title":"Use the While component","bundle":null,"doc_type":null,"release":"australia","body":"\n# Use the While component\n\nExecute a code until a specified condition is true using the While component in RPA Desktop Design Studio.\n\nWatch this video to learn how to use the While component.\n\n\\[Omitted video\\] Description: How to use the While component\n\n## Before you begin\n\nRole required: none\n\n## About this task\n\nYou can configure the properties for the While component.\n\n|Property|Description|\n|--------|-----------|\n|Delay After Execution|The number of seconds to pause after running.|\n|Delay Before Execution|The number of seconds to pause before running.|\n|Delay for each execution \\(Seconds\\)|Specified delay before each execution of the code while the condition is true.|\n|Enable Timeout|Option to set a timeout value.|\n|Timeout|Number of seconds that the operation ends after if not completed. To apply this value, you must set the **Enable Timeout** property.|\n\n## Procedure\n\n1.  In the Toolbox pane, navigate to **Loops** &gt; **While**.\n\n2.  Drag the While component to the Design surface.\n\n3.  Double-click the light-yellow colored field \\(\\[Omitted image \"expression-field.png\"\\] Alt text: Light-yellow-colored-field\\) under the WHILE component bar.\n\n4.  Enter the condition.\n\n    A Data In port is dynamically added for the parameter that contains the While condition.\n\n5.  Connect the data and control ports of the While component to the corresponding ports of the other components as described in the following table.\n\n<table id=\"table_jnw_jn1_krb\"><thead><tr><th>\n\nPort name\n\n</th><th>\n\nPurpose of connection\n\n</th><th>\n\nPort type\n\n</th><th>\n\nData type\n\n</th></tr></thead><tbody><tr><td>\n\nThe name of the port is the same as the name of the parameter that defines the condition.\n\n</td><td>\n\nTakes the value of the parameter. The component matches the value with the condition.For example, `i<=10`.\n\n</td><td>\n\nData In\n\n</td><td>\n\nObject\n\n</td></tr><tr><td>\n\nControlOut\n\n</td><td>\n\nUse the port at the end of the While Loop to continue to the next action flows.\n\n</td><td>\n\nControl Out\n\n</td><td>\n\n \n\n</td></tr><tr><td>\n\nLoopPort\n\n</td><td>\n\nUse the port to perform actions inside the While Loop \\(such as calculating expressions, logging values, and so on\\).\n\n</td><td>\n\nControl Out\n\n</td><td>\n\n \n\n</td></tr></tbody>\n</table>6.  To test the component, under the **DESIGN** tab, click **Run**.\n\n\n## While component\n\nDrag Variable component before the While component. Add Expression component and MessageBox components after the While component. In the Variable component, enter `1`. In the Expression component, enter `i+1`. Set a Breakpoint at the Expression component. In the While component, enter `i<=10`.\n\nWhen you run this automation, the value 1 is incremented to 2 and shows in the output, MessageBox, as 2. When you select **Move next** on the Design tab, the value is incremented until 11. Since the condition matches at this point, i&lt;=10, the loop ends and automation is ended.\n\n\\[Omitted image \"while-loop-example-rpa.png\"\\] Alt text: While component with Variable, Expression, and MessageBox components showing an automation.\n\n**Parent Topic:**[Loops](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/integrate-applications/loops.md)\n\n"}}