5 Essential Coding Concepts for Nocoders

May 2020

nocodetutorialzapier

While you don't need to know how to code to use nocode platforms like Zapier, learning a few fundamental concepts can make some of the more advanced nocode patterns easier to grasp. Here are 5 of them.

1. Variables

A variable is a value that can change. Often variables start off as empty, to be populated later on in the course of a running program. Other times they begin with a certain value and that value is made to change later.

Sometimes they are defined and then don't change at all (if a value is never meant to change then this is referred to as a constant).

myvar = 5
=> 5
myvar + myvar
=> 10
#increase the value of myvar
myvar = 10
=> 10
myvar + myvar
=> 20

If you've used Zapier you are already familiar with the concept of variables since every bit of data imported from external services or APIs becomes a variable that you can then use later on in your workflows.

Why is this important?

The concept of storing values or data in a way that you can use later in your script, program, or nocode workflow is a fundamental one. You won't get very far without variables and constants!

2. String / Integer / Float

These are data types that you will come across day to day when working with nocode platforms or APIs. A string is a sequence of characters, like a word or a sentence. Integers are whole numbers as the name suggests. Floats are numbers with a decimal point.

Different data types get treated differently by programming languages and nocode platforms.

For example, in most programming languages if you add together two strings, you join the strings - in programming-speak this is called a concatenation:

"Hello" + "World"
=> "HelloWorld"

If you add together two integers however, the numbers themselves are added together:

5 + 5
=> 10

What happens if you add quote marks around an integer?

"5" + "5"
=> "55"

This shows that the language / system infers the data type depending on whether you use quotation marks. Without quotation marks, the number 5 is treated as an integer. With quotation marks, it is treated as a string.

Why is this important?

It's always best to know what data type you are working with, otherwise you may experience unexpected results. For example if you send a string when an API expects an integer, or vice versa. Some nocode platforms may also "autoconvert" data types for you, so it's good to be aware that these conversions may be happening without you having explicitly configured them to happen.

Another reason this is important is because once you know (or have converted) the fundamental data type, you can often perform advanced actions on the data. For example, in Zapier when you have a string you can "find and replace" parts of the text. One real-world use case for this that I personally use is upsizing profile images from the Twitter API.

The Twitter API only gives small images in the format xHrnqf1T_normal.jpg - notice the "normal" on the end? Using a find and replace we can find _normal in this string and replace it with _400x400 which is the filename for the larger profile image.

Formatter by Zapier allows you to manipulate strings in your Zaps.

3. Arrays

Put simply, arrays are lists of data. They can be a list of integers, a list of strings, a list of variables and more. Some programming languages enforce that all elements in an array must be of the same type, and some languages don't mind you mixing types.

Here's a simple array of strings:

[
  "this",
  "is",
  "an",
  "array"
]

This array has 4 elements. Each element, in this case, is a string.

Why is this important?

You can do a lot of useful stuff with arrays. Some very common operations include:

  • Picking a random element from an array
  • Picking the first or last element from an array
  • Sorting an array by ascending or descending order
  • Performing some action on each element in the array

The Pick from a List action in Zapier is an example of how to use arrays and array operations in your nocode workflows. One real world example where this is useful is when you want to randomize certain elements in your Bannerbear designs. You could define a list of colors (or import an array of colors from somewhere) and have Zapier pick a random one to use as a background in your Bannerbear template.

4. Conditionals

Conditionals are the backbone of making your program or nocode workflow do different things depending on different circumstances.

Consider the following conditional statement:

if porridge_temperature < 65
  #eat the porridge
else
  #the porridge is too hot
end

Depending on the temperature of the porridge, the above script can go one of two ways. Either I eat the porridge, or it is too hot to eat (so I might write some code to wait a little while then retry from the start).

The above conditional statement has two possible branches. But it's possible to create many branches with simple if else logic. Here's 3 different outcomes:

if porridge_temperature < 65
  #eat the porridge
elsif porridge_temperature < 75
  #eat the porridge, but blow on it first
else
  #the porridge is too hot
end

Why is this important?

Conditionals are an important part of nocode workflows and automations. Very often we only want workflows to continue if certain criteria are met. The key here is the word "if". If you find yourself thinking "I only want this to run if…" then you need to add some conditional logic into your workflow.

Zapier has a couple of ways you can use conditional statements in your zaps.

  1. Filters - these act as barriers to prevent or allow your zap to continue. For example, I have a zap that turns tweets that I have liked into visual graphics using Bannerbear. However, very wordy tweets often don't look good in this format. So I have a filter set up to only run this zap when the tweet character count is less than X characters.
  2. Paths - these act similar to an if else conditional statement. Whereas filters will stop a zap unless certain critera are met, paths can be used to continue a zap one way under scenario A, and another way under scenario B. Personally I have not yet used the paths feature on Zapier, although it seems very powerful.

5. Loops

Loops are another fundamental operation that you will see routinely in programs.

A loop is simply some set of instructions that is repeated multiple times. This can take a few different forms:

  • Repeating the exact same instructions X times
  • Repeating the exact same instructions several times until some condition is met
  • Repeating the same instructions but with a different variable each time

And more.

Here's a simple loop in ruby:

myarray = ["this", "is", "sparta"]
newarray = []
myarray.each do |word|
  newarray.push word.upcase
end
return newarray
=> ["THIS", "IS", "SPARTA"]

Loops are incredibly useful. Probably the most common loop pattern in day to day programming is iterating over a group of objects (like a collection of blog posts, or a collection of images) and doing something with them.

Why is this important?

Understanding the concept of loops is fundamental to how zaps work on Zapier.

When you begin a zap you input one or more objects into the zap. If you put multiple objects into the zap, Zapier will "loop" over all the objects and run your zap one at a time on all of them.

This concept becomes very powerful when you start using the Code by Zapier integration to import custom data. As long as you give Zapier a collection of objects (in the form of an array) the zap will run once for each object.

Author
Jon Yongfook@yongfook

Jon is the founder of Bannerbear. He has worked as a designer and programmer for 20 years and is fascinated by the role of technology in design automation and design efficiency. Jon is a digital nomad and can be found riding a motorcycle around Asia, lives out of Airbnbs and works from coworking spaces.

Get Notified

Be first to know about new features and tips on marketing and design automation