---
schema_version: "1"
id: 881d8800d6e4e752f46c83372dccf154fc897c468244ded421dc366957f62217
title: Control Flow Operators in MDP
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/mktg/264-0-0/mcidp_data_control_flow_operators.md
canonical_url: https://help.salesforce.com/s/articleView?id=mktg.mcidp_data_control_flow_operators.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 551326fe932a297479fb9632f347774870cc9dc201577cec30d8c606d4c7e380
description: Marketing Intelligence Data Pipelines supports an assortment of control flow operators, so you can perform advanced scripting operations. Aside from the custom functions that are supported in the formula editor, you can write formulas based in C and Java Script syntax to make more complex decisions.
products:
  - Marketing
  - Marketing Cloud Intelligence
release: "264"
---
# Control Flow Operators in MDP

Marketing Intelligence Data Pipelines supports an assortment of control flow operators, so you can perform advanced scripting operations. Aside from the custom functions that are supported in the formula editor, you can write formulas based in C and Java Script syntax to make more complex decisions.

**IF**

```
if(Boolean_expression) { //Statements will execute if the Boolean expression is true }
```

For Example:

```
if (csv['Clicks'] > 550) { [Daily Goal Status] = ‘Daily Goal Reached’; }
```

**IF-Else**

C/Java-style if-then-else blocks are fully supported.

```
if(Boolean_expression){ //Executes when the Boolean expression is true }else{ //Executes when the Boolean expression is false }
```

For example:

```
if (csv['Impressions'] > 0) { "Greater than zero!"; } else if (csv['Impressions'] == -1) { "Minus one!"; } else { "Something else!"; }
```

```
if (csv['Clicks'] > 550) { [Daily Goal Status] = ‘Daily Goal Reached’ } else{ [Daily Goal Status] = ‘Daily Goal Not Met }
```

**IF-ELSE IF**

```
if(Boolean_expression 1){ //Executes when the Boolean expression 1 is true }else if(Boolean_expression 2){ //Executes when the Boolean expression 2 is true }else if(Boolean_expression 3){ //Executes when the Boolean expression 3 is true }else { //Executes when the none of the above condition is true. }
```

For Example:

```
if (csv['placement_name'] contains "abc"){ csv['placement_name'] = "ABC"; } else if (csv['placement_name'] contains "def"){ csv['placement_name'] = "DEF"; else { csv['placement_name'] = "XYZ"; }
```

**Ternary Statements**

Ternary Statements are supported just as in Java:

```
csv['Impressions'] > 0 ? "Yes" : "No";
```

**Nested Ternary Statements**

```
csv['Impressions'] > 0 ? "Yes" : (csv['Impressions'] == -1 ? "Minus One!" : "No")
```

**Foreach**

Similar to the For Each operator in Java 1.5 in both syntax and functionality. It accepts two parameters separated by a colon, the first is the local variable for the current element, and the second is the collection or array to be iterated.

For example:

```
count = 0; names = ""; foreach (name : people) { count++; names = names + " - "; } return names; 
```

Since Strings are treated as iterable objects you can iterate a String (character by character) with a Foreach block:

```
str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; foreach (el : str) { System.out.print("[" + el + "]"); } 
```

The above example outputs: \[A\]\[B\]\[C\]\[D\]\[E\]\[F\]\[G\]\[H\]\[I\]\[J\]\[K\]\[L\]\[M\]\[N\]\[O\]\[P\]\[Q\]\[R\]\[S\]\[T\]\[U\]\[V\]\[W\]\[X\]\[Y\]\[Z\]

You can also use it to count up to an integer value (from 1):

```
foreach (x : 9) { System.out.print(x); }
```

Which outputs: 123456789

**For Loop**

Standard C for-loops:

```
for (int i =0; i < 100; i++) { System.out.println(i); }
```

**Do While, Do Until**

Do While and Do Until are supported, following the same convention as Java, with Until being the inverse of While.

```
do { x = something(); } while (x != null);
```

... is semantically equivalent to ...

```
do { x = something(); } until (x == null);
```

**While, Until**

standard While, with the addition of the inverse Until.

```
while (isTrue()) { doSomething(); } 
```

or

```
until (isFalse()) { doSomething(); } 
```

Other Supported Functions:

- **For Loop**
- **Foreach**
- **Do While**
- **Do Until**
- **While**
- **Until**