Functions

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...

AMPscript and Excel

AMPscript and Excel AMPscript functions work in much the same way as they do in Microsoft Excel; that is, parameters are set for a predefined function, which are interpreted and, in turn, return a value. Several AMPscript functions are identical to Excel functions –...

Variables

Variables Similar to other programming and scripting languages, AMPscript supports variables. In programming, variables provide a convenient method of setting a function or value once, then reusing that variable by referencing it within code. This is in much the same...

Naming Convention

Naming Convention Variables are essentially ‘named containers’, where a user-defined name is applied to a defined entity, either a constant or function. Variable names are case-insensitive and can include characters or numbers, but not spaces or commas....

Declaring Variables

Declaring Variables Before a variable can be set, it must be declared. Variables are declared with the var keyword, followed by one or more comma-delimited variable names. For example, if you need to define a member’s first name, last name and membership expiry...

Setting Variables

Setting Variables Once a variable is declared, it can be set. Variables are set using a syntax that comprises of four elements: the set keyword the variable name a single equals symbol (=) a personalization string, constant or AMPscript function (which can contain...