I’ve got a while-loop, with a loop condition like so:
while (i != repetitionString.Length || !repetitionString[i].Equals(')'))
The first part of the condition checks to see that the end of the collection is not reached. Is it possible to not execute the part following || after the left side’s condition is not met? The reason behind this is that if the left side’s condition is not met, then this means that the collection is out of bounds, and hence the right side’s evaluation/checking will throw an exception.
Is it possible to do this?
you just simply use && instead of ||. Since the right condition is supposed to be checked only if the first one has returned true.