# How do expressions work? ( Easy explonation )

Get help using Construct 2

### » Wed Oct 07, 2015 6:39 am

I know that it exist manual entries about expressions but i haven't been able to understand them well enough to get the hang of expressions. I have made successfull expressions but some doesn't work. I made one today that doesn't work. Expressions seem to always need " " in them. Is that rigth? Do they need ( ) too? How do you write a expressions in easy to understand words. Do you write it "( Sprite )" or "Sprite"()? I may go deeper into what my expression that doesn't work is but i just explain that if i need to.
B
12
S
2
Posts: 267
Reputation: 1,344

### » Wed Oct 07, 2015 7:17 am

https://www.scirra.com/manual/78/expressions

They basically express certain things in a quantitative form.
B
49
S
23
G
66
Posts: 1,151
Reputation: 39,103

### » Wed Oct 07, 2015 7:22 am

It depends on what you want to do.
Anything inside " " is just text.
Ex: "Sprite"
That is is just an expression for text with a value of Sprite.

Parenthesis () have two purposes. The first is just like in math to control what operations are done first.
Ex: 1+2*3 = 7
Ex: (1+2)*3 = 9

The second purpose is for expressions that take parameters.
Ex: sin(45)
Ex: min(1, 3, 2)

Beyond that it should be pretty simple. But feel free to post the equation you made that doesn't work and describe what you want it to do.
B
94
S
33
G
128
Posts: 5,489
Reputation: 81,541