For statement inside setup and loop function

This compiles, so yes, you can use "for" inside setup and loop:

int positions_check[6] ={ 1,2,3,4,5,6 };

void setup() {
  for(int i=0; i<2; i++) 
    pinMode(positions_check [i],INPUT);//setting the context of this table as inputs
}//setup

void loop() {
  for(int i=0; i<2 ;i++) 
    positions_check[i] = digitalRead(positions_check [i]); //reads the current status of position sensors
}//loop