CSE 11 Chapter Notes - Chapter 3: Operand, String Literal, Switch Statement

101 views5 pages

Document Summary

3. 1 branching directs a program to execute either one statement group or another if else statements if (expression) { else { example: bonusval = 12, if (bonusval < 12) , numitems = 100, else , numitems = 200; Braes not necessarily need an else statement unless provide an alternative grouping of something remember to group the necessary statements together within branches or else might cause different result. Relational/equality operator a < b a > b a <= b a >= b a == b: equal to a != b, not equal to evaluates to a boolean value, either true or false. Works for integer, character, floating point: except floating point might lack precision, and string should not be compared example, if (usernum == 0) , system. out. println(zero), else , system. out. println(non-zero); Multi-branch if-else if (expr1) { else if (expr2) { else if (exprn) { else { usually use to detect ranges of numbers.

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