COMP 202 Lecture Notes - Lecture 11: Return Type, Semicolon

18 views3 pages
jc123 and 40170 others unlocked
COMP 202 Full Course Notes
100
COMP 202 Full Course Notes
Verified Note
100 documents

Document Summary

We can condition the execution of blocks of code on the evaluation of boolean expressions. When the condition expression evaluates to true, the following block of code will execute. if (condition) { The expression inside the parentheses of an if must evaluate to a boolean value. if (x < y) { The three prints statements above will only execute if x < y evaluates to true. ** else statements cannot exist by themselves, but if can** If we would like to do something when a condition is true and something else when a condition is false we can use if-else blocks. If the condition evaluates to true, the contents of the if block executes, and the contents of the else block is skipped. If the condition evaluates to false, the contents of the if block is skipped, and the contents of the else block executes.

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