Dale - Computer Science Illuminated 272

# Dale Computer - 8.3 Functionality of Imperative Languages 245 Instructions considered as a single group are called a compound statement Ada and

This preview shows page 1. Sign up to view the full content.

8.3 Functionality of Imperative Languages 245 Instructions considered as a single group are called a compound statement . Ada and VB.NET use reserved words to end a construct, so no special grouping is necessary. C++ and Java group statements within curly braces. They call this grouping a block . Because we only get to the else branch if the Boolean expression is not true, we can make use of the information to ask a series of questions. Let’s alter and expand the algorithm with a finer grain on our temperature problem. The only way to get to the second if statement is if the first expression is not true, so if the second expression is true, you know that the temperature is between 71 and 90. If the first and second expressions are not true and the third is, then the temperature is between 51 and 70. The same reasoning leads to the conclusion that Philadelphia weather is between 33 and 50, and “Stay inside” is written if the temperature is less than or equal to 32. Any one of the branches can contain a sequence of statements.
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 01/13/2011 for the course CSE 1550 taught by Professor Marianakant during the Fall '10 term at York University.

Ask a homework question - tutors are online