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.
Hi Everyone! I hope this information helps. You can download the full code using the links below. Feel free to modify it to fit your needs. I’d love to get your feedback, did this information help in some way?
AMPscript Commenting
https://gist.github.com/nmaratasdev/dae3553f798ee22bceec3365670ed630
AMPscript Inline Delimiters
https://gist.github.com/nmaratasdev/a4b2cf844d873d97ccfdc26b2d3981bf
AMPscript Block Delimiters
https://gist.github.com/nmaratasdev/9f23deae5cc7d72bc5d1002112567ae7