Can you determine the terminating boolean expression of a for loop at runtime? : I'm in a situation where it would be really nice to be able to determine what boolean expression I use for the terminating statement of a for loop at runtime. Or in more simpler words, decide whether I want i > 0, or i < file.length and decrement or increment `i` respectively. I know you can use lambdas to make the iterator either decrement or increment at runtime, explained in [this][1] SO question, but is something along the same lines possible for the terminator?

From trying to attempt this myself with `System.Action` to act as an anonymous function so I can still access the objects the for loop uses whilst inside action having some logic to determine whether or not I go forwards or backwards (this ended up with me realising that this wont work), it seems as if this is very much so the case of, if it is possible, it's far more complicated and is not worth the boilerplate code required compared to just having two loops within an if/else statement. I can't be the only one that has wondered this, surely!

  [1]: http://stackoverflow.com/questions/14255618/store-an-operator-in-a-variable