---
title: Boolean and conditional logic functions
slug: analytics/docs/boolean-and-conditional-logic-functions
docTags: 
createdAt: 2026-07-20T15:44:31.526Z
---

Using NetScript in Optimizely Analytics, you can perform boolean and conditional logic operations.

## if..then..else

Define a sequence of conditional statements. The result corresponds to the first true condition. The else value is optional, and the default result is null.

**Function**:

```auto
if condition1 then result1 [else if condition2 then result2...] [else resultN] end
```

**Data type**: input type

**Example**:

```auto
if 'test' == 'test' then true else if 'test2' == 'test2' then true else false end
if “test” == “test1” then “test1 success” else if “test2” == “test2” then “test 2 success” end
```

**Result**:

```auto
true
test 2 success
```

## not (bool1)

Return the boolean negation of bool1.

**Function**:

```auto
not (bool1)
```

**Data type**: boolean

**Example**:

```auto
not ('a' == 'b')
not ('a' != 'b')
```

**Result**:

```auto
true
false
```

## bool1 or bool2

Determine whether bool1 or bool2 is true.

**Function**:

```auto
bool1 or bool2
```

**Data type**: boolean

**Example**:

```auto
'a' != 'b' or 'a' == 'b'
'a' == 'b' or 'a' == 'b'
```

**Result**:

```auto
true
false
```

## bool1 and bool2

Determine whether both bool1 and bool2 are true.

**Function**:

```auto
bool1 and bool2
```

**Data type**: boolean

**Example**:

```auto
'a' == 'a' and 'b' == 'b'
'a' != 'b' and 'a' == 'b'
```

**Result**:

```auto
true
false
```

## input1 == input2

Check whether input1 and input2 are equal.

**Function**:

```auto
input1 == input2
```

**Data type**: boolean

**Example**:

```auto
'snow' == 'snow'
'snow' == 'food'
```

**Result**:

```auto
true
false
```

## input1 != input2

Check whether input1 and input2 are unequal.

**Function**:

```auto
input1 != input2
```

**Data type**: boolean

**Example**:

```auto
'snow' != 'food'
'snow' != 'snow'
```

**Result**:

```auto
true
false
```

## input1 \< input2

Check whether the value of input1 is less than input2.

**Function**:

```auto
input1 < input2
```

**Data Type**: boolean

**Example**:

```auto
57 < 65
65 < 57
```

**Result**:

```auto
true
false
```

## input1 > input2

Check whether the value of input1 is greater than input2.

**Function**:

```auto
input1 > input2
```

**Data Type**: boolean

**Example**:

```auto
52 > 43
43 > 52
```

**Result**:

```auto
true
false
```

## input1 \<= input2

Check whether the value of input1 is less than or equal to input2.

**Function:**

```auto
input1 <= input2
```

**Data Type**: boolean

**Example**:

```auto
18 <= 19
19 <= 18
```

**Result**:

```auto
true
false
```

## input1 >= input2

Check whether the value of input1 is greater than or equal to input2.

**Function**:

```auto
input1 >= input2
```

**Data Type**: boolean

**Example**:

```auto
74 >= 23
23 >= 74
```

**Result**:

```auto
true
false
```

## is\_null(input)

Determine whether the input is null. The input can be any value.

**Function**:

```auto
is_null(input)
```

**Data Type**: boolean

**Example**:

```auto
is_null(null)
is_null(6)
```

**Result**:

```auto
true
false
```

## anything in all\_values

Check whether the value *\<anything>* is found in the collection *all\_values*.

**Function**:

```auto
<anything> in all_values
```

**Data Type**: boolean

**Example**:

```auto
1 in ["1","2","3","4"]
0 in ["1","2","3","4"]
```

**Result**:

```auto
true
false
```

## anything == all\_values

Check whether two collections contain the same values in the same order.

**Function**:

```auto
<anything> == all_values
```

**Data Type**: boolean

**Example**:

```auto
["1", "2", "3", "4"] == ["1", "2", "3", "4"]
["0"] == ["1", "2", "3", "4"]
```

**Result**:

```auto
true
false
```
