---
schema_version: "1"
id: 5ee838dacd8cd2593f1fc60d253da6cbc2e53f2af287fb6aa0a855f3e7ae3bfa
title: Evaluating Conditions in AMPscript
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/marketing-cloud/ampscript/guide/language-basics/mc-ampscript-guide-language-basics-condition-evaluation.md
canonical_url: https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/guide/mc-ampscript-guide-language-basics-condition-evaluation.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 996809ef438d0433b766f612961a299559828ed4765b8f347a8e18ce80d44c68
products:
  - AMPscript for Marketing Cloud
  - Marketing Cloud
---
# Evaluating Conditions in AMPscript

AMPscript supports conditional logic, enabling your marketing team to personalize each message and customer touchpoint.

## Comparison Operators

In AMPscript, you can use comparison operators to compare two values. AMPscript uses the operators in this table.

| Operator | Description              |
| -------- | ------------------------ |
| `==`     | Is equal to              |
| `!=`     | Is not equal to          |
| `>`      | Greater than             |
| `<`      | Less than                |
| `>=`     | Greater than or equal to |
| `<=`     | Less than or equal to    |

These operators are commonly used in [If statements](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/guide/mc-ampscript-guide-language-basics-if-statements.md). For example, this statement checks to see if the numeric value of the `@age` variable is 30 or higher.

```
If @age >= 30 then
  ...
EndIf
```

## Join Operators

You can also use join operators to join multiple conditions. AMPscript includes the join operators in this table.

| Operator | Description                   |
| -------- | ----------------------------- |
| `and`    | Both conditions must be true  |
| `or`     | Either condition must be true |

You can use parentheses to control the order in which AMPscript evaluates complex expressions.

For example, this `If` is matched in one of two ways:

- If the value of the `@age` variable is 30 or higher and the value of the `@predisposition` variable is "High"; or
- If the value of the `@age` variable is 55 or higher and the value of the `@predisposition` variable is "Normal".

```
If (@age >= 30 and @predisposition == "High") or (@age >= 55 and @predisposition == "Normal") then
  ...
EndIf
```

## Not Operator

The `not` operator reverses the logic of an evaluation. For example, this statement is matched when the value of the `@age` variable is 55 or higher, and the value of the `@predisposition` variable is anything other than "High".

```
If @age >= 55 and not @predisposition == "High"
  ...
EndIf
```

## See Also

- [If Statements](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/guide/mc-ampscript-guide-language-basics-if-statements.md)
