mercredi 31 juillet 2019

An if condition gets ignored

This bit of the code is supposed to check if the password length is good, butif the password length is greater than or equals 16, it skips the if condition and doesnt print the sentence.

/* This bit of the coe just checks the length of the password */
if(Password.length() >= 8) {
    if(Password.length() <= 10) {
        System.out.println("Medium length of password");
        }
    }else if(Password.length() < 8) {
        System.out.println("Bruv youre asking to be hacked");
    }else if(i >= 10) {
        if(Password.length() <= 13) {
            System.out.println("Good password length");
            }
            /* The part that fails */
            else if(Password.length() >= 16) {
                System.out.println("Great password length");
            }

    } ```

/* The code should output "Great password length" if the password length is greater than or equal to 16 but it doesnt output anything if it's greater han or equal ot 16 */

Aucun commentaire:

Enregistrer un commentaire