How to keep the value of a variable not to change??

 
static bool up, down;

int start()
{
if (line_a crossUp line_b) { up=1; down=0;}
if (line_a crossDown line_b) { up=0; down=1;}

return(0);
}

when line_a cross up line_b,I expect that up could be 1 ,untill Line_a cross down Line_b.
But in fact both up and down are initialized to 0 when line_a don't cross line_b. So I can't judge if line_a cross up or down line_b last time.