Syntax

Any language has rules and principles. In the context of human languages, syntax is a set of rules for putting words together to make a sentence. For formulas, this isn't any different. Syntax in ProtoPie is a set of rules for putting elements, e.g., text, numbers, layer properties, and variables, together to make a formula.

Using Literal Values

There are specific rules to use elements, e.g., layer properties, text, and numbers, in formulas.

Layer property

To refer to a layer, use backticks (`) around the layer name. For clarity, we recommend layers to have unique names, instead of duplicate names.

To use a layer property, add a period (.) with the property after the second backtick.

Learn more about layer properties.

Text

Use double quotation marks (") around the text.

Text with multiple lines

To add a line break, add "\n" between words or characters.

Number

Use Arabic numerals (0-9) only.

Color

Use colors in the #FFFFFF format (hex color code).

Variable

To refer to a variable, use the variable name as it is. A variable name can only contain Latin alphabetical letters, numbers, and underscores.

Learn more about variables.

Doing Calculations

To do simple calculations, use the basic arithmetic (+, -, *, /) and modulo (%) operations.

Arithmetic Operations

The basic arithmetic operations for numbers are addition (+), subtraction (-), multiplication (*), and division (/).

5

Modulo Operation

To calculate the remainder of a division, use the modulo operation (%). For example, 5 % 2 results in 1, simply because 5 divided by 2 has a quotient of 2 and a remainder of 1.

1

Combining Text

Arithmetic operations usually apply to numbers. However, to combine text, it's possible to use addition (+). When a text is "added" to another text, the result is a new text with the two texts combined.

Text + Text

Use the addition (+) sign to combine two or more texts. As a reminder, always use double quotation marks (") around the text.

"helloworld""12"

Text + Number

Use addition (+) sign to combine two or more texts and numbers. The result is always a new text.

"hello1234"
Back To Top