Choose where you’d like to start

Continue

Overview

The continue statement skips a particular iteration within a loop based on specified condition and continues with the iteration process. Typically used instead of using conditional statements to skip/ignore certain portion of a loop.

Note: Both break and continue Deluge task helps control the for each loop. The difference between them is that the break statement terminates the execution of the loop and the continue statement terminates only the current iteration of the loop.

Syntax

continue;

 

The syntax can be placed within the loop after a conditional statement. When the condition is met, the current iteration is skipped while the loop continues.

This task can be used in the following events

When a record is Created
On LoadYes
On ValidateYes
On SuccessYes
On User inputYes
Subform on add rowYes
Subform on delete rowYes
When a record is Created or Edited
On LoadYes
On ValidateYes
On SuccessYes
On User inputYes
Subform on add rowYes
Subform on delete rowYes
When a record is Edited
On LoadYes
On ValidateYes
On SuccessYes
On User inputYes
Subform on add rowYes
Subform on delete rowYes
When a record is Deleted
On ValidateYes
On SuccessYes
Other workflow events
On a scheduled dateYes
During approval processYes
During payment processYes
In a Custom FunctionYes
In an Action item in reportYes

Example 1

The list - colors contains 4 values. In the following example, when the value "Red" is encountered in the list, the execution of the current iteration is skipped.

 colors = List();
 colors.add("Green");
 colors.add("Red");
 colors.add("Blue");
 colors.add("Red");
 colors.add("Teal");
 for each rec in colors
 {
 if(rec == "Red")
 { 
 continue;
 }
 info rec;
 }

Returns:
Green
Blue
Teal

Example 2

Let us say a list variable orders contains the details of orders placed such as: order ID, order status, and customer email. To send a mail to every order except for the orders with the status - "Delivered", we can use the "continue" statement as shown below:

order1 = Collection(); 
order1.insert("id":"1000"); 
order1.insert("status":"Approved"); 
order1.insert("customer-email":"james@zylker.com"); 
 
order2 = Collection(); 
order2.insert("id":"1001"); 
order2.insert("status":"Pending"); 
order2.insert("customer-email":"august@zylker.com"); 
 
order3 = Collection(); 
order3.insert("id":"1002"); 
order3.insert("status":"Delivered"); 
order3.insert("customer-email":"betty@zylker.com"); 
 
orders = Collection(); 
orders.insert(order1); 
orders.insert(order2); 
orders.insert(order3); 
 
for each order in orders 
{ 
if(order.get("status")=="Delivered") 
{ 
continue; 
} 
sendmail 
[ 
from:zoho.adminuserid 
to:order.get("customer-email") 
subject:"Order Delay Notice" 
message:"Due to the current measures to protect the safety of our distribution center employees, please expect delays in processing and delivering your order. We apologize for the inconvenience." 
] 
} 

Related Links

Get Started Now

Execute