1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
3 * File Name: dowhile-006
5 * Description: do...while statements
7 * A general do...while test.
9 * Author: christine@netscape.com
10 * Date: 26 August 1998
12 var SECTION = "dowhile-006";
13 var VERSION = "ECMA_2";
14 var TITLE = "do...while";
17 writeHeaderToLog( SECTION + " "+ TITLE);
19 DoWhile( new DoWhileObject( false, false, 10 ) );
20 DoWhile( new DoWhileObject( true, false, 2 ) );
21 DoWhile( new DoWhileObject( false, true, 3 ) );
22 DoWhile( new DoWhileObject( true, true, 4 ) );
26 function looping( object ) {
29 if ( object.iterations <= 0 ) {
35 function DoWhileObject( breakOut, breakIn, iterations, loops ) {
36 this.iterations = iterations;
38 this.breakOut = breakOut;
39 this.breakIn = breakIn;
40 this.looping = looping;
42 function DoWhile( object ) {
49 if ( object.breakOut )
55 } while ( looping(object) );
57 // statements should be executed if:
58 // do...while exits normally
59 // do...while exits abruptly with no label
65 // statements should be executed if:
66 // do...while breaks out with label "innie"
67 // do...while exits normally
68 // do...while does not break out with "outie"
75 "hit code after loop in inner loop",
76 ( object.breakIn || object.breakOut ) ? false : true ,
81 "hit code after loop in outer loop",
82 ( object.breakOut ) ? false : true,