CSCI 1301 Lecture Notes - Lecture 5: Boolean Expression, Primitive Data Type

28 views7 pages

Document Summary

Flow of control: the order in which statements are executed. Up to now, the order has been sequential. The program forms a tree (with multiple branches). A loop statement repeats a sequence of steps. The steps are repeated until a stopping condition occurs, at which point, the program breaks out of the loop . The type boolean and boolean expressions boolean is a primitive type with two values: true and false. A boolean expression evaluates to either true or false. false. 2 >= 1 //greater than or equal to. 1 != 2 //not equal to numdogs > numcats balance <= 0. A boolean variable can be given the value of a boolean expression by using an assignment operator. boolean ispositive = (number > 0); It"s good style to use names that suggest having a truth value. ispositive or systemsareok. The primary type is an if-else statement. if (booleanexpression) else. A compound statement (or block)is enclosed in { }.

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