# Operators

The operators described below can be used to manipulate data.

## Mathematical Operators

The following arithmetic operators are supported:

OperatorExample UseDescription
-p-qSubtraction
--pReturns the negative of a variable's value

*

p * qMultiplication
/p/qDivision
^p^qPower

## Vector Operators

When using vectors the following operators apply:

OperatorExample UseDescription
.xV.x (eg. fpItem.position.x)Returns the 1st component of a vector
.yV.y (eg. fpItem.position.y)Returns the 2nd component of a vector
.zV.x (eg. fpItem.position.z)Returns the 3rd component of a vector
-V-W (eg. fpItem.position+Object.position)Subtraction
*V*W (eg. fpItem.position*Object.position)Dot Product
*V*p (eg fpItem.position*5)Scalar Multiplication
/V/p (e.g. fpItem.position/2)Scalar Division
^V^W (eg. fpItem.position^Object.position)Cross Product

## Comparative Operators

Forest effects includes an If function to allow you to create conditional rules.

This function uses the following syntax:

if(p,q,r)

Where p is a logic test which returns q if it returns true or r if it returns false.

To create the conditional tests for an IF function you use following operators:

OperatorExample UseDescription
==p==qReturn true if p is equal to q
<p<qReturn true if p is less than q
>p>qReturn true if p is greater than q
>=p>=qReturn true if p is greater than or equal to q
<=p<=qReturn true if p is less than or equal to q
|p|qReturn true if p or q are true
&p&qReturns true if p and q are true