I want to put if statements within my for loop checking parameters but I don't know how to do it, I want this so I don't have to duplicate my code and make it huge, redundant and messy.
This is what I am trying to do
for( int i = elevator1CurrentStatus.floorNumber; if(boundary == 9) i<boundary else i>boundary ;i+=i+countDirection){
//Code Here
}
How would I implement this? Basically I want the test statement stating whether to count up or down to depend on a variable and select which direction based on that variable. Count direction is implemented earlier and is either +1 or -1. for( int i = elevator1CurrentStatus.floorNumber; (if(boundary == 9) iboundary;) ;i+=i+countDirection)
for( int i = elevator1CurrentStatus.floorNumber; (if(boundary == 9) i<boundary else i>boundary) ;i+=i+countDirection)
if(boundary == 9) i<boundary else i>boundary