Functions

In programming, a function is a named section of a program that takes some input values (or arguments) to perform a specific task and produce an output value. While other scripting languages offer user-defined functions (for example, JavaScript), AMPscript uses a declarative approach through predefined functions which are primarily oriented to displaying, transforming and storing customer data and marketing content.

AMPscript functions are pure functions, which mean they take some input and return an output based on the input. Pure functions form the foundation of functional programming and are independent, which means that you can move them around your code, making it easy to refactor or adapt. This programming style simplifies the development process for users as it doesn’t follow an explicit control flow or an imperative sequence, which in turn allows flexibility in development through applying ‘creative’ design patterns to achieve an outcome result.