# Conditional operators - 3.12

## Data360 Analyze Server Help

Product
Data360 Analyze
Version
3.12
Language
English
Portfolio
Verify
Product family
Data360
Product name
Data360 Analyze
Title
Data360 Analyze Server Help
2023
First publish date
2016
CAUTION:
This topic relates to Data360 Analyze Script which is the language that is used in some superseded nodes. If you are looking for help configuring the Python-based nodes, please see Python scripting.

Conditional operators can be used to identify whether a specified condition is true or false.

See if.

## if

If the predicate evaluates to true, then execute the consequent statement or statements. Otherwise, execute the alternate statement or statements. Null evaluates to false, so if the predicate is null, then the alternate statement or statements will be executed.

Used in the following format, where `predicate` must be a Boolean, `consequent` and `alternate` may be any expression and `consequent statements` and `alternate statements` may be any set of statements:

```if predicate then consequent [else alternate] ```

```if predicate then { consequent statements } [else { alternate statements }]```

```if predicate then { consequent statements } [else alternate] ```

Note: You do not have to specify `then` in `if` statements, it is optional.

Examples

`if false then “hi” else 3.7 # value: 3.7`

`if true then 1 else null # value: 1`

```if ((2 > 5) or (42 >= 21)) then{ “hi” } else 3.7 # value: “hi”```

```if ((42 < 21) and (42 > 84)) then { someVariable = 12 “hi”} else { someVariable = 24 3.7 } # value: 3.7, and someVariable is 24.```

## switch

Compares the test value to each case value in order. If the test value equals a case value, then the value of the result is the value of the switch expression. If no case value matches, the default code block is used. Uses the same comparison criteria as the equals operator.

Used in the following format, where `test`, `case result` and `default` may be any expression:

``` switch test {case result}* default ```

The return value type is the same as a `result` parameter or `default`.

Examples

``````
# value: 3.5
test="hello"
test.switch (
"hi",    1,  	# case="hi", result=1
2.7,	    "bye",	# case=2.7, result="bye"
"hello", 3.5,	# case="hello", result=3.5
null)		# default=null``````

See if.