Join two if statement into one