Tutorial

Getting Started with Macros

Macro Editor

User Interface

Menus and Toolbar

Editing Macro Statements

Expression Editor

Macro Debugging

How To

Using variables

Finding and modifying objects

Creating new page content

Asking for user input

Storing persistent data

Sorting objects

Sample Macros

Concepts

Expressions

Objects

Properties

Variables

Data Types

Arrays

Functions

Literals

Operators

Comments

Last updated on: April 17, 2021
Also available as a single HTML file

Onetastic Macro Documentation > Concepts > Operators

Operators

Macro expressions can contain several different operators. They can be used for assignments, comparisons, arithmetic or logical operations and string concatenations. Following is a list of all the operators. Operators can be operating on one (unary), two (binary) or three (ternary) sub expressions:

Arithmetic Operators

OperatorNameType
+Additionbinary
Subtractionbinary
*Multiplicationbinary
/Divisionbinary
%Modulobinary
Unary Minusunary
+Unary Plusunary
 

Increment/Decrement Operators

OperatorNameType
++$vPre-Incrementunary
––$vPre-Decrementunary
$v++Post-Incrementunary
$v––Post-Decrementunary
 

Assignment Operators

OperatorNameType
=Assignmentbinary
+=Addition Assignmentbinary
–=Subtraction Assignmentbinary
*=Multiplication Assignmentbinary
/=Division Assignmentbinary
%=Modulo Assignmentbinary
&&=Logical And Assignmentbinary
||=Logical Or Assignmentbinary
&=Concatenation Assignmentbinary
 

Comparison Operators

OperatorNameType
==Equalsbinary
!=Not Equalsbinary
<Less Thanbinary
<=Less Than or Equalsbinary
>Greater Thanbinary
>=Greater Than or Equalsbinary
 

Logical Operators

OperatorNameType
&&Logical Andbinary
||Logical Orbinary
!Logical Notunary
 

String Concatenation Operator

OperatorNameType
&Concatenationbinary
 

Ternary Operator

OperatorNameType
?:Ternary Operatorternary

Operator Precedence

In macro expressions, following operator precedence rules apply. The order of operations can be changed by providing parantheses. The Expression Editor automatically fully parenthesizes any expression so that what operator precedence rules were used is obvious. If you type 5 == 2 + 3 * 4 to Expression Editor it will automatically parse and convert it to 5 == (2 + (3 * 4)).

PrecedenceCategoryOperators
1Increment/Decrement++––
2Unary!+
3Product*/%
4Sum & Concatenation+&
5Comparison==!=<<=>>=
6Logical And&&
7Logical Or||
8Ternary?:
9Assignment=+=–=*=/=%=&&=||=&=
Note: Assignments are evaluated right to left

Reference

Statements

For

ForEach

If

Else If

Else

Switch

Case

Default

While

Expression

Comment

Break

Continue

Return

Hierarchy Objects

NotebookRoot

Notebook

SectionGroup

Section

Page

Page Objects

Title

Outline

Table

Column

Row

Cell

Paragraph

Text

Image

EmbeddedFile

Tag

Other Objects

DialogBox

Functions

Array Functions

Color Functions

Data Store Functions

Date/Time Functions

Dialog Box Functions

Macro Execution Functions

Object Functions

String Functions