Robotc NXT Encoder help

I’m using Robotc for NXT and I’m trying to learn the encoders. So i made a simple forward then left with encoders program. The robot runs the go forwards part but completely ignores the part were it is supposed to turn left. Can anyone help me out and tell me what i did wrong here?

task main()
{

nMotorEncoder[rightMotor] = 0; //clear the LEGO encoders in motors B and C+
nMotorEncoder[leftMotor] = 0;

while (nMotorEncoder[rightMotor] < 1500) //while the encoder wheel turns one revolution (360)
{
motor[rightMotor] = 50; //turn both motors on at 50 percent power
motor[leftMotor] = 50;
}

motor[rightMotor] = 0; //turn both motors off
motor[leftMotor] = 0;

wait1Msec(1000);

//new line

while (nMotorEncoder[leftMotor] < 500) //while the encoder wheel turns one revolution (360)
{
motor[rightMotor] = 50; //robot will turn left
motor[leftMotor] = 0;
}

motor[rightMotor] = 0; //turn both motors off
motor[leftMotor] = 0;

wait1Msec(3000); // wait 3 seconds to see feedback from the debugger screens
// open the “NXT Devices” window to see the distance the encoder
//spins. The robot will coast a little bit.
}

The encoders don’t go back to zero after you’ve read them. You don’t want to go to a certain distance; you want to go a certain distance beyond where you are now. If you’re at 1500 and you want to go 500 more, you want to drive until 2000.