---
schema_version: "1"
id: ee1eb7d458b6dd597199e02973352f7627dd2ebb892a198d8c6430aaa9857d63
title: Control Flow Operators
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/mktg/264-0-0/dato_control_flow_operators.md
canonical_url: https://help.salesforce.com/s/articleView?id=mktg.dato_control_flow_operators.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 6570c67ce032e0059d78825500e739c4c99fbabb7e1e6c91548a2910243b41b2
description: Marketing Cloud Intelligence 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

Marketing Cloud Intelligence 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**