[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 193
  • Last Modified:

checking strings in a while statement

Hi,

I have a simple while loop
while ((rolled != go)  || ( chances < 6))

I know this doesn't work as I'm comparing 2 strings that refer to different objects, how can I convert the comparison rolled != go so it does work (not equal to).

thanks
0
sjsharp80
Asked:
sjsharp80
2 Solutions
 
Ajay-SinghCommented:
try this
 
while(!rolled.equals(go) || changes<6) {
}
0
 
objectsCommented:
while(!rolled.equals(go) && chances<6) {
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now