If statment not working ROBOTC

Hey so I have this if and if else statement inside my code.

if (potVal >= 3000) && (potVal =< 4095) {
	startTask(BallRed);
}
if(potVal >= 0) && (potVal =< 2000){
	startTask(BallBlue);
}
else{
	startTask(Cap);
}

However, whenever I hit compile in order to check for bugs I get this error.

**Error**:Unexpected '&&' during parsing

Error:Unexpected ‘<’ during parsing
Error:Unexpected ‘&&’ during parsing
Error:Unexpected ‘<’ during parsing
I checked the RobotC documentation and from what I can find this seems to be the right way to it. However, I keep getting the errors above every time I compile. Am a doing something wrong? Also quick note the if and if else statements are in the task autonomous in the competition template. Any help is appreciated thanks in advance.

Not enough parenthesis. An if statement needs to follow this form

if( expression ) {
}
else {
}

so try your code as

if( (potVal >= 3000) && (potVal =< 4095) ) {
	startTask(BallRed);
}
if( (potVal >= 0) && (potVal =< 2000) ) {
	startTask(BallBlue);
}
else{
	startTask(Cap);
}
2 Likes

may try using “>=”

adding filler for 20 character…

Thank you @jpearman for you response I tried what you suggested and it worked. I also had another error in my code =< is suppose to be <=. Once again thank you for assistance.