COP 3502 Chapter Notes - Chapter 3: Semicolon, Boolean Expression, Switch Statement
Document Summary
The program can decide which statements to execute based on a condiion. Selecion statements: statements that let you choose acions with alternaive courses. Boolean expression: an expression that evaluates to a. Boolean variable: a variable that holds a boolean value. Boolean literals: true and false, treated as reserved words and cannot be used as ideniiers in the program. An if statement is a construct that enables a program to specify alternaive paths of execuion. One-way if statement: executes an acion if and only if the condiion is true. The syntax for a one-way if statement is: if (boolean-expression) { statement(s); } Flowchart: a diagram that describes an algorithm or process, showing the steps as boxes of various kinds, and their order by connecing these with arrows. An if-else statement decides the execuion path based on whether the condiion is true or false.