Dale - Computer Science Illuminated 271

Dale - Computer Science Illuminated 271 - 244 Chapter 8...

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

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 244 Chapter 8 High-Level Programming Languages The true branch is known as the then branch, but as you can see from the table, the branch may or may not be labeled as such. The false branch is called the else branch and is labeled as such in each of these examples. The great variety in how information is written for the human to see is demonstrated in the different way that the strings are written. In our description of the behavior of the if statement we said that either branch could have none, one, or a sequence of instructions. If the sequence is empty, then the else branch is just not there. The example earlier shows how to write the code if there is just one instruction, but how do we write a sequence of instructions? High-level languages all have a way of considering a sequence of instructions as a single group. Let’s add a second output statement to the else branch of our algorithm and see how these three languages handle it. Language Ada if Statement — F" S"=eX\=" > f: Xz"9 M\X?IX" E> 4)D AePQ"X o 9"P"ooe=‘4Bi "lo" M\X ?IX" E> 4. l zX AePQ"X o eSS=DS= eX"4Bi M\X ?IX" E> 4L\X 9DX 9"P"ooe=‘4Bi "9 —i — ?F" S"=eX\=" > f:B Fz"9 3o =D6?4)D AePQ"X o 9"P"ooe=‘4B *lo" 3o =D6?4. l zX AePQ"X o eSS=DS= eX"4B 3o =D6?4L\X 9DX 9"P"ooe=‘4B *9 — — ?X" PD\X "lo" C PD\X PD\X D S"=eX\=" > f:B << 4)D AePQ"X o 9"P"ooe=‘4i VB.NET C++ << 4. l zX AePQ"X o eSS=DS= eX"4i << 4L\X 9DX 9"P"ooe=‘4i > f:B 9X?)D AePQ"X Java — ?X" S"=eX\=" J‘oX" hD\XhS= "lo" C J‘oX" hD\XhS= J‘oX" hD\XhS= D o 9"P"ooe=‘4Bi 9X?4. l zX AePQ"X o eSS=DS= eX"4Bi 9X?4L\X 9DX 9"P"ooe=‘4Bi ...
View Full 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