vendredi 8 juillet 2016

How to check if the next or last value in an expression exists in java

Hello so what I am working on is how to check if a number for instance 10 and look at the next number which would be 11 and the number before 10, 9 and then to cancel out those numbers and return false.

public static boolean continue_sequence(int x, int y){

    if(x >= 0 && y == -1 ){
        return false;
    }
    // above is separate check that works below is the one I am trying to fix
    else if(x >= 0 && y += 1 || y -= 1){
        return false;
    }
    else{
        return true;    
    }
}

Aucun commentaire:

Enregistrer un commentaire