CSCI 1301 Lecture Notes - Lecture 6: Lazy Evaluation, String Literal, Boolean Expression

30 views10 pages

Document Summary

Consider the following code fragment: if(x > 5) Would the answers for the previous question change if we removed all curly braces ({ and }) from the code? if(x > 5) When there are more than 2 possible outcomes. if(boolean_expression_1) { && (and) -> used to evaluate multiple conditions. If all conditions are met only then the result is true otherwise false example :- int x = 110; || (or) -> if one of the condition is met then the result is true, result is false only when all conditions are false. example :- int x = 10; && and || are also called conditional operators. Sometimes only part of a boolean expression needs to be evaluated to determine the value of the whole thing. If a is true, then (a || b) is true. If a is false, then (a && b) is false. In these cases, the program won"t evaluate b.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents