AMPscript Functions

Functions are self contained blocks of code that perform specific tasks. Functions usually take in data, process it, and return a result. Learn more on the next slide. Functions are written like this: functionName(1)

Section functionName
This section is the unique name that describes the function.

Section ()
The values you insert into the parentheses is what the function evaluates.

Section 1
This section represents the parameters that can be used inside this function. Multiple parameters are separated by commas.


AMPscript Block Delimiters

To identify AMPscript, it must be surrounded by opening and closing delimiters or it will be ignored. AMPscript uses two types, Block Delimiters and Inline Delimiters. This section focuses on Block Delimiters. Block Delimiters are useful when you have several lines of AMPscript code. They can be placed anywhere in the email but most developers will include this at the top. This way AMPscript logic placed at the top of the email will cascade down the email when using it in the HTML markup.


AMPscript Inline Delimiters

To identify AMPscript, it must be surrounded by opening and closing delimiters or it will be ignored. AMPscript uses two types, Block Delimiters and Inline Delimiters. This section focuses on Inline Delimiters. Inline Delimiters are useful when you need to call a function outside of an AMPscript block. You can do this by using the inline method. Simply insert %%= script goes here =%% into your HTML code.


AMPscript Comments

Every good developer knows why it’s important to add comments to your code. AMPscript comments are ignored by the application and do not show up in the final deployment. This differs from HTML comments. HTML comments can still be viewed after deployment by inspecting the source code. AMPscript comments are processed before the send and thus removed at the time of send. This can be useful if you want to ensure comments are absolutely hidden from subscribers.


Gallery