CS 161 - Introduction to Programming with PHP

Lecture Notes: 24 Sept 2010
 

Conditionals and Flow Control

  • if (expr) statement;
  • if (expr) statement; else statement;
  • while (expr) do statement;
  • do statement; while (expr);

Expressions used to make decisions:

  • Comparisions (which evaluate to a boolean)
  • true/false (in many variations)

Assignment #3 Due: Wednesday 29 September

Modify your last programming assignment to check for invalid or irrational input, to generate appropriate feedback when these occur and not attempt any calculations.

Your program should also be modified to not display a denomination of change if none is to be returned, e.g. "0 quarters" and use plurals correctly (e.g. it should print "1 nickel" instead of "1 nickels")

Page last updated 23 September 2010