More examples of programs with procedures
Download
1 / 6

More examples of programs with procedures - PowerPoint PPT Presentation


  • 52 Views
  • Uploaded on

More examples of programs with procedures. Making decisions. In Pascal there are two types of statements that enable the computer to make decisions. IF-THEN-ELSE CASE. IF-THEN (ELSE to be discussed later). IF (Boolean expression) THEN STATEMENT ;

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' More examples of programs with procedures' - kerryn


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

Making decisions
Making decisions

  • In Pascal there are two types of statements that enable the computer to make decisions.

    • IF-THEN-ELSE

    • CASE


If then else to be discussed later
IF-THEN (ELSE to be discussed later)

IF (Boolean expression) THENSTATEMENT;

  • The compiler will evaluate the Boolean expression. If it is TRUE then the STATEMENT is executed. If it is FALSE then the STATEMENT is skipped.


Comparison expressions
Comparison expressions

  • = Equal to

  • <> Not equal to

  • < Less than

  • > Greater than

  • >= Greater than or equal

  • <= Less than or equal


If then else
IF-THEN-ELSE

IF (Boolean expression) THENSTATEMENT1

ELSE

STATEMENT2;

  • The compiler will evaluate the Boolean expression. If it is TRUE then STATEMENT1 is executed. If it is FALSE then STATEMENT2 is executed.

  • Note: no semicolon after STATEMENT1.


For tuesday
For Tuesday

  • Reminder: HW #5 is due

    • IT is on the web - Marateck’s HW #4

  • Read sections 7.1-7.6 and 7.7-7.12


ad