Basic Programming Question

Yeah so the "flag" is basically like a variable and whenever the button is pressed it turns true and at the end it turns the "flag" false. The else statement uses and AND gate and checks to see if the "flag" is false and the button is not pressed. Makes sense, I'm just kinda new to Arduino, I got it today. Thanks for the help.