Coding for two if statement with on digitalread

Yeah, the question is that the second black line have the same digitalread which is <5, and when I put the scond if statement which is "if (val<5) digitalWrite(mainswitch, LOW)" and the motor will not start. I guess these two If statement activate at the same time, but what I really want if to start the first IF and then start the second IF, can you please help me with that? Thankyou