Sylvie
1
How, in VCS c++ do I make an if statement with 2 variables.
I want to do something IF a joystick value is in between 2 numbers
I tried
if(controller1.axis3.value>=-10&&controller1.axis3.value<10){
//brake motors
}
It didn’t work. Can anyone tell me the reserved word(s) I’m looking for?
callen
2
You could write roughly the same thing with a single check as
if ( abs(controller1.axis3.value() ) < 10 ) {
}
Your code should work if you put the parentheses in after “value.”
Sylvie
3
ABS means absolute value, right?
abs means the function abs, which conveniently returns the absolute value of its argument as one might expect.
Speaking of functions, value is a method, and needs (arguments). Specifically, it needs no arguments, like this: ().
Are you saying his original code would have worked if it just had the () arguement?
callen
6
Yes, which is why I wrote this above: