Skip to content

Instantly share code, notes, and snippets.

View nmaratasdev's full-sized avatar

Nolan Maratas nmaratasdev

View GitHub Profile
@nmaratasdev
nmaratasdev / ampscript-math-functions-beginner-add.amp
Created December 10, 2021 18:04
ampscript-math-functions-beginner-add
<!-- Example Code -->
%%[
/**
* Add Logic
* The Add() is used to add two numeric constants.
*/
VAR @number1, @number2, @results
SET @number1 = 1
SET @number2 = 2
SET @results = Add(@number1,@number2)
@nmaratasdev
nmaratasdev / ampscript-basics-part2-comments.amp
Created December 10, 2021 14:18
ampscript-basics-part2-comments
<!-- Example Code -->
%%[
/* Insert Comment Here */
VAR @string1
SET @string1 = "Hello"
/**
* Insert Comment Here
*/
VAR @string2
@nmaratasdev
nmaratasdev / ampscript-basics-part2-inline-delimiters.amp
Created December 10, 2021 14:17
ampscript-basics-part2-inline-delimiters
<!-- Example Code -->
%%[
/* script goes here */
VAR @string
SET @string = "hello world"
]%%
<p>%%=Uppercase(@string)=%%</p>
<!-- Example Output -->
HELLO WORLD
@nmaratasdev
nmaratasdev / ampscript-basics-part2-block-delimiters.amp
Created December 10, 2021 14:17
ampscript-basics-part2-block-delimiters
<!-- Example Code -->
%%[
/* script goes here */
VAR @string
SET @string = "Hello World"
]%%
<p>%%=v(@string)=%%</p>
<!-- Example Output -->
Hello World
@nmaratasdev
nmaratasdev / ampscript-basics-part1-variables.amp
Last active January 2, 2022 07:26
ampscript-basics-part1-variables
<!-- Example Code -->
%%[
/**
* Declaring & Setting Variables
* Below is an example how to declare and set variables with AMPscript.
*/
VAR @FullName
SET @FullName = "John Doe"
]%%
<p>Hi %%=v(@FullName)=%%, your shipment has arrived!</p>
@nmaratasdev
nmaratasdev / ampscript-basics-part1-attributes.amp
Last active January 2, 2022 07:26
ampscript-basics-part1-attributes
<!-- Example Code -->
%%[
/**
* Attributes & Data Extension Values
* Below is an example how you can use attributes to personalize your email.
*/
VAR @Birthdate, @FirstName
SET @Birthdate = [Birthdate]
SET @FirstName = [FirstName]
]%%
@nmaratasdev
nmaratasdev / ampscript-basics-part1-constants-string.amp
Last active January 2, 2022 07:26
ampscript-basics-part1-constants-string
<!-- Example Code -->
%%[
/**
* Constant (String Values)
* A string is a set of one or more letters, numbers, spaces or special characters. These constant values must be surrounded (delimited) by double or single quotes. They can also include the same type of delimiting quote inside by doubling it.
*/
VAR @string1, @string2, @string3, @string4
SET @string1 = 'String text goes here'
SET @string2 = "String text goes here"
SET @string3 = "My string's inside quotes!"
@nmaratasdev
nmaratasdev / ampscript-basics-part1-constants-numeric.amp
Last active January 2, 2022 07:26
ampscript-basics-part1-constants-numeric
<!-- Example Code -->
%%[
/**
* Constant (Numeric Values)
* Numeric constant values consist of one or more digits. They are formatted as unquoted numerals. They can include 1 decimal point and an introductory minus sign for negative numbers. Commas, are not permitted.
*/
VAR @number1, @number2, @number3
SET @number1 = 123
SET @number2 = -123
SET @number3 = 123.456
@nmaratasdev
nmaratasdev / ampscript-basics-part1-constants-null.amp
Last active January 2, 2022 07:26
ampscript-basics-part1-constants-null
<!-- Example Code -->
%%[
/**
* Constant (Null Values)
* etaphysical.
*/
VAR @string1, @string2, @string3, @string4
SET @string1 = "String1 Copy Here"
SET @string2 = ""
SET @string3 = ''
@nmaratasdev
nmaratasdev / ampscript-basics-part1-constants-boolean.amp
Last active January 2, 2022 07:26
ampscript-basics-part1-constants-boolean
<!-- Example Code -->
%%[
/**
* Constant (Boolean Values)
* Boolean constant values must use the words true or false. They are not surrounded by quotes. They are also NOT case sensitive.
*/
VAR @toggle1, @toggle2, @toggle3, @toggle4, @toggle5, @toggle6, @toggle7, @toggle8
SET @toggle1 = true
SET @toggle2 = false
SET @toggle3 = True