Computer Science 1026A/B Lecture Notes - Lecture 3: Substring, Boolean Data Type, Floating Point

41 views6 pages
terubarenuka and 39895 others unlocked
COMPSCI 1026A/B Full Course Notes
26
COMPSCI 1026A/B Full Course Notes
Verified Note
26 documents

Document Summary

The (cid:858)if(cid:859) state(cid:373)e(cid:374)t: allows a program to carry out different actions depending on the nature of the data being processed, two key words if and else. Compound statement span multiple lines & consists of a header and a statement block ( if" statement is a simple example: header. : includes a comparison statement and requires a colon : at the end: statement block. : a group of one or more statements. : signal that one or more statements are part of a given compound statement. : executed only if header is true, if header is false, the entire block is skipped: block structured code. :code to calculate discount received after spending more than 100: common errors. : if the same code is duplicated in each branch, move it out of the if statement. :can be used anywhere that a value is expected. :complexity is bad . this shortcut is difficult to read and a poor programming practice!

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