Writing DataWeave scripts
Now that we understand the basics of the language, let’s get started on learning how to write DataWeave scripts. In this section, you’ll learn about operators, selectors, variables, functions, and scope and flow control. These will give you the basics to start transforming your data.
Using operators
If you come from a different programming language background, you probably already know what operators are – those characters that help you transform or compare data. Let’s take a look at the different types of operators in DataWeave and their purpose.
Mathematical operators
These operators transform two values into one. They are mostly used for numbers but they can also be used with other data types:
- + Addition: This operator adds two values. It can be used to add date and time-related types and numbers or to append a new item to an array (i.e.,
1 + 2
). - - Subtraction: This operator subtracts two values. It can...