Math & variables in Make, some clarifications needed

Welcome to the Make community!

This is because Make uses JavaScript (TS?) on the backend, and it is exactly how JavaScript (programming language) will treat those variable types.

If you don’t believe me, just open up your browser console (which also uses JS) and type these in:

Numeric + String = String

Screenshot_2023-10-13_091017

Numeric + Numeric = Numeric

Screenshot_2023-10-13_091021

Numeric - (Numeric or String) = Numeric

Screenshot_2023-10-13_091009

JavaScript uses the + operator for both Math and concatenating Strings. So when any of the variables are strings, the output is concatenated instead of summed up.

JavaScript doesn’t use the - operator for anything other than Math, so the values are treated as Numeric. This is called Type Coercion.

What happens if you subtract a non-numeric value?

You get NaN (not a number), basically an error.

Screenshot_2023-10-13_091002

For more information about Type Coercion on Make, see https://www.make.com/en/help/mapping/type-coercion

4 Likes