id/email
password
forgot password | create account
about | help | prefs
ReadingBatcode reading practice

 

 

Boolean ExpressionsAndOr6

prev  |  next  |  chance

Parentheses override the order of evaluation.

public static boolean compare(boolean val1, boolean val2, boolean val3) {
    boolean result = val1 && (val2 || val3);
    return result;
}
Function Call  Return Value
compare(true, true, true)
compare(true, true, false)
compare(true, false, true)
compare(true, false, false)
compare(false, true, true)
compare(false, true, false)
compare(false, false, true)
compare(false, false, false)

Experiment with this code on Gitpod.io

⬅ Back