What is AMPscript?
AMPscript is the proprietary scripting language within Salesforce Marketing Cloud/ExactTarget. It is used for dynamic content in emails, landing pages, SMS, and push messages. Some of my favorite things to do with AMPscript is personalize emails and create complex dynamic emails with conditional logic.
AMPscript can be used in code blocks or within the HTML code of the email also known as inline.
The most important characters in AMPscript are: %%
All AMPscript blocks and inline start and end with a pair of percent signs.
(Hint: You will get an error in your email if you accidentally have %% anywhere in the text as it automatically tries to process it as AMPscript)
AMPscript code blocks are enclosed with: %%[ ]%%
AMPscript inline blocks are enclosed with: %%= =%%
So what is the difference between code blocks and inline? Inline can only handle 1 function, where as a code block can have multiple steps, including setting variables and processing conditional logic.
AMPscript is interpreted from top to bottom, which means that variables have to be declared and set before they can be used.
From Top to Bottom: Preheader, HTML body, Text Body, Subject Line.