Entering a while loop with a not equal to string
I am trying to enter a while loop when a string is not equal to "stop". However, I cannot seem to get it work correctly. I have tried using:
while (!variable.equalsIgnoreCase ("stop") )
and it does not work. I have also tried:
while variable != "stop" // even though != is not a string operator.
I either end up entering the loop when I enter "stop" or I end up with an infinite loop - which really stinks. I have Googled my brains out and can't find anything on entering a while loop if a string is not equal to another string. I have found information for if...else statements, but I am not allowed to use if...else statements. I have to use a while statement.
If anyone could help I would very, very appreciative!