# AMPscript delimiters, variables and core functions

*Marketing Cloud Engagement Developer Study Guide · Programmatic Languages · Last updated November 3, 2026 · https://www.certifyforce.com/study-guide/marketing-cloud-engagement-developer/programmatic-languages/ampscript-delimiters-variables-and-core-functions*

Inline, block and tag-based AMPscript syntax, variables, comments and case rules, positional parameters, conditions, the output functions, and the string, date, math and null-test functions that code-reading questions use.

- Certification: Salesforce Marketing Cloud Engagement Developer
- Exam section: Programmatic Languages
- Study guide: https://www.certifyforce.com/study-guide/marketing-cloud-engagement-developer

**Official exam objective:**

> Given a scenario, demonstrate knowledge of AMPscript and SSJS language syntax and functions.

## What the exam expects

- Read inline, block and tag-based AMPscript, and spot code that breaks the delimiter, declaration or comment rules.
- Pass function parameters in the documented order, including skipping an optional parameter.
- Evaluate conditions built from comparison, `and`, `or` and `not` operators, and trace If, ElseIf and Else branches.
- Predict exactly what string, date, math, output and null-test functions return in a snippet.
- Know when TreatAsContent() is needed to render personalization strings stored as data.
- Key terms: **inline AMPscript** (`%%= =%%`, one function, nesting allowed); **code block** (`%%[ ]%%`, many statements); **tag-based syntax** (`<script runat="server" language="ampscript">`); **positional parameter** (an argument identified only by its place in the call).

## Key facts

| Fact | Detail | Source |
|---|---|---|
| Inline limit | One function per inline section; nesting allowed | [Adding AMPscript](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/guide/mc-ampscript-guide-language-basics-adding-to-content.html) |
| Closing a block | Same delimiter type that opened it | [Adding AMPscript](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/guide/mc-ampscript-guide-language-basics-adding-to-content.html) |
| Script tag default language | JavaScript, unless `language="ampscript"` | [SSJS Syntax Guide](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/ssjs_syntaxGuide.html) |
| Declaring variables | Blocks only; a new variable is null | [Variables in AMPscript](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/guide/mc-ampscript-guide-language-basics-variables.html) |
| Comments | `/* */` in blocks and script tags, never inline | [Using Comments](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/guide/mc-ampscript-guide-language-basics-comments.html) |
| Skipping an optional parameter | Pass null or "" in its position | [Function Parameters](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/guide/mc-ampscript-guide-language-basics-parameters.html) |
| Else per If block | Only one; ElseIf can repeat | [If Statements](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/guide/mc-ampscript-guide-language-basics-if-statements.html) |
| Output() with a literal | Returns an error | [Output()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-utilities/mc-ampscript-reference-utilities-output.html) |
| OutputLine() break | CRLF, so HTML shows one line | [OutputLine()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-utilities/mc-ampscript-reference-utilities-output-line.html) |
| IndexOf() not found | Returns 0; positions are 1-based | [IndexOf()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-string/mc-ampscript-reference-string-index-of.html) |
| Date units | `Y`, `M`, `D`, `H`, `MI` | [DateAdd()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-date-time/mc-ampscript-reference-date-time-date-add.html), [DateDiff()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-date-time/mc-ampscript-reference-date-time-date-diff.html) |
| Empty() vs IsNull() | Empty catches null and ""; IsNull only null | [Empty()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-utilities/mc-ampscript-reference-utilities-empty.html), [IsNull()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-utilities/mc-ampscript-reference-utilities-is-null.html) |

## Check yourself

- When does a variable declared with `Var` hold null?
- Why does a `<script runat="server">` tag with no `language` attribute run as SSJS?
- What does FormatDate() return when you pass it only a date string?
- Which input types can an If condition evaluate?

## Sources

- [Adding AMPscript to Your Content](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/guide/mc-ampscript-guide-language-basics-adding-to-content.html)
- [Variables in AMPscript](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/guide/mc-ampscript-guide-language-basics-variables.html)
- [Using Comments in AMPscript](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/guide/mc-ampscript-guide-language-basics-comments.html)
- [Case Sensitivity (AMPscript)](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/guide/mc-ampscript-guide-language-basics-case-sensitivity.html)
- [AMPscript Function Parameters](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/guide/mc-ampscript-guide-language-basics-parameters.html)
- [Evaluating Conditions in AMPscript](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/guide/mc-ampscript-guide-language-basics-condition-evaluation.html)
- [If Statements (AMPscript)](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/guide/mc-ampscript-guide-language-basics-if-statements.html)
- [SSJS Syntax Guide](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/ssjs_syntaxGuide.html)
- [Output() (AMPscript)](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-utilities/mc-ampscript-reference-utilities-output.html)
- [OutputLine() (AMPscript)](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-utilities/mc-ampscript-reference-utilities-output-line.html)
- [IndexOf() (AMPscript)](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-string/mc-ampscript-reference-string-index-of.html)
- [Substring() (AMPscript)](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-string/mc-ampscript-reference-string-substring.html)
- [RegExMatch() (AMPscript)](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-string/mc-ampscript-reference-string-regex-match.html)
- [DateAdd() (AMPscript)](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-date-time/mc-ampscript-reference-date-time-date-add.html)
- [DateDiff() (AMPscript)](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-date-time/mc-ampscript-reference-date-time-date-diff.html)
- [FormatDate() (AMPscript)](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-date-time/mc-ampscript-reference-date-time-format-date.html)
- [Mod() (AMPscript)](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-math/mc-ampscript-reference-math-mod.html)
- [Subtract() (AMPscript)](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-math/mc-ampscript-reference-math-subtract.html)
- [Empty() (AMPscript)](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-utilities/mc-ampscript-reference-utilities-empty.html)
- [IsNull() (AMPscript)](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-utilities/mc-ampscript-reference-utilities-is-null.html)
- [TreatAsContent() (AMPscript)](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-content/mc-ampscript-reference-content-treat-as-content.html)

## About the full unit

The "Core concepts", "Exam traps" and "Worked scenario" sections of this unit, its 14 linked practice questions, and unlimited timed mock exams are included with the Marketing Cloud Engagement Developer pack (USD $19): https://www.certifyforce.com/practice-exams
