To test the ON/OFF status of an I/O bit, use the TESTIO( label) function or TESTBIT(n, x) function.
IF TESTIO (IN1) THEN
ELSE
ENDIF
You should not use a FOR NEXT loop to check the status of an input because the physical inputs are only updated at the end of the ladder logic scan or execution of the REFRESH statement.