if (variable == TRUE)
{
  variable = FALSE;
}

why not just
variable = FALSE;