Breaking out of my IF statement

Hello Y'all...reckon I'm having issues with my programming.

Basic Idea:

I want to use a Ping sensor to calculate a distance. Let's say distance is > 2 inches I want the robot to move.It's basically a wall avoiding robot. I'll have a few of my own changes in with it but for the most part this is the idea.

  1. 2 DC DRIVES FOR REAR WHEELS
  2. 1 Stepper to control front wheels
  3. A servo to control the rotating neck
  4. A Parrallax ping sensor
  5. An LCD to indicate state
  6. 2 leds, one red and one green to indicate motor movement.

Im only at the point now where I have the LEDS on and indicated the state of the motor.

How do I break from the If statement in a<5? I am just experimenting with different ways to control the hardware.

#include <LiquidCrystal.h>                      /*Library for LCD*/
#include <Servo.h>                              /*Library for SERVO*/

LiquidCrystal lcd (8,9,10,11,12,13);

Servo LWHEEL;
Servo RWHEEL;

const int led1  = 2;
const int led2  = 3;

int a = 0;

void setup()
{
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
LWHEEL.attach(5);
RWHEEL.attach(6);
delay(1000);
LWHEEL.write(160);
RWHEEL.write(160);
delay(1000);
LWHEEL.write(0);
RWHEEL.write(0);
Serial.begin(9600);
lcd.begin(16,2);
lcd.print("Setup complete");
delay(5000);
}

void loop()
{
lcd.print("....LOOP....");
if (a < 5)
  {
    digitalWrite(led1, HIGH);
    RWHEEL.write(0);
    delay(100);
    RWHEEL.write(45);
    delay(100);
    RWHEEL.write(90);
    delay(100);
    a++;
  }
else if (a > 5)
{
  
    
    digitalWrite(led1, LOW);
    digitalWrite(led2, HIGH);
    delay(5000);
    a=0;  
  }

}

What happens when a == 5 ?

Pete

Where? That will then mean if A is equal to 5?

you have if (a < 5) and then else if (a > 5)

neither of those handles the case where a is 5.

Pete