So started learning PROS today wondering how to write a if statement and else. So if you press a button motors turns on and if not pressed motors set to 0. Any help would be appreciated!

Thanks Juster

This code would make the motor in port 1 move at 127 power when button 8D is pressed on the main joystick:

while(true){  //infinite loop
  if(joystickGetDigital(1, 8, JOY_DOWN)){ //if button 8D is pressed
    motorSet(1, 127); //set the motor to 127
  else{ //else (if button 8D is not pressed)
    motorSet(1, 0); //set the motor to 0
  delay(20);  //Always have a delay in infinite loops

If you need basic programming help, there are plenty of C programming tutorials on the web and is very helpful for PROS-specific things.

Well thanks wondering why does it say “JOY_DOWN” does this mean where the button is. For example, if you want Button 8U you would replace it to “JOY_UP”
That’s one question, second one is if I want this for a lift you would place this in “lift.c” or somewhere else. Thanks again

That is correct.

It depends on the structure of your program. For me this code could go in several different places, and I would just choose the place that is the cleanest and most organized.