



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Notes; Professor: Padua-Perez; Class: INTRO COMP PROG VIA WEB; Subject: Computer Science; University: University of Maryland; Term: Unknown 1989;
Typology: Study notes
1 / 6
This page cannot be seen from the preview
Don't miss anything!




Used with comparison operators to create more complex expressions.
Operators
Logical and (&&) – expr1 && expr
otherwise is false. Example: LogicalOp1.html Logical or (||) – expr1 || expr Expression is false if and only if both expressions are false otherwise is true. Example: LogicalOp2.html Logical Not (!) – !expr Inverts the boolean value of the expression.
You can combine if statements to handle different cases. This approach to organize if statements to handle different cases is called the Cascaded If Statement. Cascaded If statement general form:
If (expr1) // Statement is executed if expr1 is true else if (expr2) // Statement is executed if expr2 is true else if (expr3) // Statement is executed if expr3 is true else // If none of the above expressions is true
Notice it is not a JavaScript statement. Once one of the cases is executed no other case will be executed. You can use { } to enclose more than one statement. Example: See CascadedIf.html