The Mullinator
Newbie
- Joined
- May 24, 2003
- Messages
- 5,794
- Reaction score
- 0
This is in Java however I suspect its the same in C++ as well.
For the project I am doing I am being forced to use a while loop that will keep looping as long as a String is either A or B. However the compiler keeps returning an error stating that I can't have an "or" statement within the parameter for the loop. More specifically it is telling me:
This is the line in question:
while(workStack.peek() == "*" || "/")
workStack.peek() returns a string.
Am I doing something wrong and it is possible to do what I want? Or do I have to find another way.
For the project I am doing I am being forced to use a while loop that will keep looping as long as a String is either A or B. However the compiler keeps returning an error stating that I can't have an "or" statement within the parameter for the loop. More specifically it is telling me:
operator || cannot be applied to boolean,java.lang.String
This is the line in question:
while(workStack.peek() == "*" || "/")
workStack.peek() returns a string.
Am I doing something wrong and it is possible to do what I want? Or do I have to find another way.