Ifs and Expressions
Class Notes
if (x < "10") {
print "Hi!";
} else {
print "Bye!";
}
if (x < "10") {
print "Hi!";
} else {
print "Bye!";
}
if (x < "10") {
print "Hi!";
} elseif (x < "20") {
print "Hello!";
} else {
print "Bye!";
}
De Morgan's Law
PvQ can only fail to be true if P and Q are both false both must be true in order for the concept to be fullfilled
ex: “I don’t like chocolate or vanilla” vs “I do not like chocolate and I do not like vanilla” (same thing!)
credit: https://www.whitman.edu/mathematics/higher_math_online/section01.03.html
public class Test1
{
public static void main(String[] args)
{
int x = 2;
int y = 3;
System.out.println(!(x < 3 && y > 2));
}
}
# https://runestone.academy/ns/books/published/apcsareview/Conditionals/cDeMorgans.html