FORUMS: list search recent posts

# Expression writing

FAQ   •   VIEW ALL
 Expression writing on Apr 29, 2017 at 1:28:21 pm

Hi everyone,

Ive been studying expressions and have noticed that at the end of certain expressions there is [x,y] at the end of an expression.

I want to know the significance of putting [x,y] or [xPosition,yPosition,zPosition] at the end?

```For example: var x = transform. position[0]; var y = Math.sin(time); [x,y] Or var xPosition = transform.xRotation; var yPosition = transform.yRotation; var zPosition = transform.zRotation; [xPosition,yPosition,zPosition ] ```

 Re: Expression writingon Apr 29, 2017 at 4:18:36 pm

Hi,

In the first lines, you declare and give a value to your variables (that's why you use "var" before, although it isn't obligatory in expressions).

Then, in the last line(s), you use these variables to assign a value to your property (position in your cases). The brackets are there to express a multi-value property (x,y or x,y,z for position / x,y,z rotation, etc...)
Other properties (like 2d rotation) only take one value, so you don't use the brackets.

Hope this clarifies things a bit for you ðŸ˜‰
Cheers !