## Recommended Posts

Hello,

I decided to finally start to learn vex. But I think now I rather suicide. Can you tell me what is wrong with this code?

if (@P.y > 0){

v@Cd = set(0,1,0);}else {
v@Cd = set(1,0,1);}

if (v@Cd == set(0,1,0));{
v@N = 5;}

So basically I what is above zero should be green. And what is green should be get a normal with value of 5.

Thank you

##### Share on other sites

Hi Gabor, it seems to work as expected. You can assign v@N = 5, but when doing so, you are abusing the syntax a bit. Houdini casts that 5 into a vector {5,5,5}

Did you want something like this?

```if (@P.y > 0) {
v@Cd = set(0,1,0);
}else {
v@Cd = set(1,0,1);
}

if (v@Cd == set(0,1,0)) {
v@N = {0,5,0}; // I changed this line
}```

##### Share on other sites

Or maybe you wanted this?

```if (@P.y > 0) {
v@Cd = set(0,1,0);
}else {
v@Cd = set(1,0,1);
}

if (v@Cd == set(0,1,0)) {
v@N *= 5; // this line changed
}```

##### Share on other sites

Hello,

Thank you for your help. I see the issue was I put a semicolon after this: if (v@Cd == set(0,1,0)).

Edited by Gabriel_Wolf
• 2

## Create an account

Register a new account