BRAZE LIQUID — Data Types — Liquid For Technical Marketers

BRAZE LIQUID — Data Types — Liquid For Technical Marketers

🗣️ WATCH FULL YOUTUBE VIDEO HERE 🗣

https://youtu.be/6LiZBX_8Yik

What’s up everyone, my name is Allan, Founder and Consultant at For Now Marketing, and welcome to LIQUID FOR TECHNICAL MARKETERS!

Today, we’re going to talk about 3 datatypes in Liquid: String, Number, and Boolean.

Let’s get started!

String

The first and the main datatype is called a String.

Strings are sequences of characters wrapped in single or double quotes.

Characters, meaning they can be any letters, numbers, and symbols. So it really doesn’t matter what the value of the String is, but as long as it’s surrounded by quotes, that’s what makes the variable a String.

BRAZE EXAMPLE:

For example, here in Braze, we have variable called first_name, and allan is surrounded in quotes. and because it’s surrounded in quotes, our variable “first underscore name” is a string variable.

By the way, single quotes and double quotes both work in Liquid, as long as we stay consistent within a single tag. So we can use single quotes and this will render fine, we can use double quotes and this will render fine, but if we use one single quote and one double quote, this will not render.

Because Strings are so flexible and so many of the Liquid filters apply to Strings, majority of the variables we’ll work with, both in this class and most likely in your Marketing team’s database, will be a String variable.

Number

The next datatype is a Number. And a Number is simply… a Number. If we want to break it down further, there are integers which are 0, positive, and negative whole numbers, and there are floats, which are decimals. You may have also heard of doubles which are also decimals, very similar to floats.

To clarify, this is a different type of float than a root beer float.

The biggest thing to note is that Number datatypes are not surrounded by quotes. Remember, as soon as a variable is surrounded by quotes, even if the value itself is clearly a Number, the variable becomes a String. So if you’re trying to create a Number variable, make sure to not surround it in quotes.

BRAZE EXAMPLE:

{% assign favorite_number = 7 %}

{% assign favorite_number_string = “7” %}

Boolean

The last datatype is a Boolean.

Booleans are either true or false.

I’ve always thought Boolean was a very technical term that sounded funny, but a Boolean is literally just true or false. Those are the only two values a Boolean variable can have: true or false. So it’s actually the simplest datatype.

Once again, even with Booleans, make sure to not surround the values true or false with quotes, because then, they’ll be considered Strings.

One final note about Booleans: make sure to lowercase the Boolean values true or false, otherwise Liquid will not work properly.

{% assign boolean_correct = true %}

{% assign boolean_string = “true” %}

{% assign boolean_incorrect = True %}

Nil

Let’s wrap up this video with one more quick bonus data type, which is Nil. Nil means the value does not exist, or nil is an absence of value.

And in the context of Braze Liquid, Nil is actually different than blank.

Nil is useful when we want to render or not render certain parts of our message, based on whether some data exists or not.

Thank You!

That’s it for today! Thank you for watching, and see you next time!

allan@fornowmarketing.com

fornowmarketing.com

Previous
Previous

BRAZE LIQUID — Assign & Capture — Liquid For Technical Marketers

Next
Next

LIQUID FOR TECHNICAL MARKETERS: 7 Rules of Liquid Conditionals