CISC 124 Lecture Notes - Lecture 5: For Loop, Switch Statement, Boolean Expression

67 views3 pages

Document Summary

Both increment i i++, increment happens after. Sum = 10*i then i = i + 1. Sum = 10 * (++i); i = i + 1 then 10* i. Named constants: named constant is an identifier for a permanent value, final data-type constantname = value; Without final modifier, it can be reassigned. Naming conventions: lowercase for variables and methods. Every additional word will have first capitalized letter. Ex. getname: capitalize every letter of a named constant. Boolean: c1 == s1 is false, boolean can(cid:495)t be converted to another data-type, use comparison operators, boolean operators, short-circuit evaluation. If the first evaluation of an && boolean is false it will return false and not evaluate the second. Boolean b = (x != 0) && (5/x >1); Returns false, but if evaluated both there would be a runtime error because 5/0 is undefined.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents