Sequence

Summary

A simple sequence of statements.

Situation

You need to do a simple computation.

Needs

Some variables whose values need to be changed.

Provides

Variables with changed values.

Action

One statement after another. For example, to take a meal price, and compute the tip and total:

  • ' Compute tip and total.
  • sTipAmount = sMealPrice * 0.15
  • sTotal = sMealPrice + sTipAmount

sMealPrice goes into this sequence, and sTipAmount and sTotal come out.

Variables in, variables out

sMealPrice has to have a value before the code runs, otherwise the expression sMealPrice * 0.15 won't mean anything.

You can tell that sTipAmount and sTotal come out of the sequence, because they are on the left of the assignment statements (e.g., sTipAmount = sMealPrice * 0.15). A variable on the left of an assignment statement has a value put into it.