Unexpected Behavior HELP!!!

I'm running into some issues with my code where a check is made to some switches but I keep getting a response that is not true initially, throwing off my code.

Both pins un-triggered are HIGH. When the code initializes by serial command, the code to change stepper dierection is running before the switch is hit. The rest of my code is working fine when looking for the end stop triggered event but have already run into this once before and managed to find a way around it but it came back in my latest code :( HELP!!!

Also the Serial.println in the endSwitchTriggered does not run somehow but the function is returning true? why??? It is boggling my mind...

boolean endSwitchTriggered() {
  if ((digitalRead(Z_MAX_PIN) == LOW) || (digitalRead(Z_MIN_PIN) == LOW)) {
    Serial.println("REACHED END");
    return true;
  } else{
    return false;
  }
}

////////////LOOP
bool atEnd = false;
if(endSwitchTriggered) {
        if(!atEnd) {
          changeDirection(E1_DIR_PIN); //run once
        }
        atEnd = true;
} else if (atEnd) {
        atEnd = false;
}

// Move a step

//////////////END LOOP
if(endSwitchTriggered) {

This is equivalent to saying "if this function exists" it doesn't run the function. Put () after the function name.

HAHAHAHA. Didn’t see that… D’oh

Done fixed. Many thanks! :) :) :) :) :) :) :) :) :) :)

if(endSwitchTriggered) {
        if(!atEnd) {
          changeDirection(E1_DIR_PIN); //run once
        }

If the end switch was triggered, isn't that the definition of being "at the end"? Having two mechanisms that mean "is at the end" is a recipe for disaster.