public void main ( ) {
|
| |
// Copyright 2007 R.G.Baldwin |
| // Program demonstrates the use of value-returning functions. |
| doInOrder { |
| |
// Coach reports his current width. |
| // Show various stages of construction of statement. |
| doInOrder { |
| |
// Begin constructing the statement. |
| coach .say( My width is ); |
| // Drag in world's (a+b) function. |
| coach .say( ( My width is + dummy ) ); |
| // Drag in world's what.toString() function. |
| coach .say( ( My width is + ( coach .toString() ) ) ); |
| // Drag in coach.getWidth() function. |
| // and set duration property. |
| coach .say( ( My width is + ( ( subject = coach .getWidth() ) .toString() ) ) ); duration = 5 seconds |
| } |
| } |
| // Coach raises both arms and reports new width. |
| doInOrder { . . } |
| |
doTogether { |
| |
coach.upperBody.leftArm .roll( RIGHT , 0.25 revolutions ); |
| coach.upperBody.rightArm .roll( LEFT , 0.25 revolutions ); |
| } |
| coach .say( ( Now my width is + ( ( subject = coach .getWidth() ) .toString() ) ) ); duration = 5 seconds |
| } |
| } |