How is the switch statement more efficient than if/else?
It sounds like the result is one greater than you'd like, so check your logic. Can strengthCount ever be zero?
Type: Posts; User: GregBrannon
How is the switch statement more efficient than if/else?
It sounds like the result is one greater than you'd like, so check your logic. Can strengthCount ever be zero?
You try it and come back to ask for help with whatever problems you're having. I've shown you all but for ~3 lines of code.
You could define an array of strength strings, like:
String[] strengthString = { "No password; da fuq hacks",
"Very Weak",
...
I'm not sure I agree with your premise in general, but I definitely can see from your code that not all 'if' statements can be converted to more efficient switch statements. If you can suggest how...