Button Latch Help

When I programmed in Robot C, We had a program for a button latch where for example, if I press ButtonL1 once, the motor starts and if I press it again, the motor stops. I understand how the program works, I just cannot figure out how to translate this to vex code. No matter what I try, syntax is not correct.

In Robot C it looked like this:
task usercontrol ()
{
bool buttonLatch =0;
while (true)
{

if(vexRT[Btn7L] ==1)
{
delay(10);
while(vexRT[Btn7L] ==1);
buttonLatch = buttonLatch ^ 1;
}

if (buttonLatch == 1)
{
motor[port8] = -80;
}

else if vexRT[Btn7U] == 1)
{
motor[port8] = 127;
}

else if vexRT[Btn7D] == 1)
{
motor[port8] = -127;
}

else
{
motor[port8] = 0;
}
}
}