Google
 

Trailing-Edge - PDP-10 Archives - BB-4157F-BM_1983 - fortran/test/dowhil.for
There are 9 other files named dowhil.for in the archive. Click here to see a list.
	PROGRAM DOWHIL

! This software is furnished under a license and may only be used
! or copied in accordance with the terms of such license.

! Copyright (C) Digital Equipment Corporation 1983

C	CDM
C	July 1982

C	Tests the DOWHILE( cond ) statement.

	DIMENSION NRRY(4:5)
	LOGICAL LOG
	INTEGER VAR

C-100-	Simple

	I=1; J=10
	KNT=0

	DO WHILE(I .LT. J)

	I = I+1
	KNT = KNT + 1

	END DO

	IF (KNT .NE. 9) TYPE 100, KNT
100	FORMAT(' ?Error 100. KNT = 'I', should = 9')

C-200-	With label

	I=3
	DO 201 WHILE(I.NE.5)
	I = I+1
201	NRRY(I) = I

	IF (NRRY(4) .NE. 4) TYPE 210, 4,NRRY(4),4
	IF (NRRY(5) .NE. 5) TYPE 210, 5,NRRY(5),5
210	FORMAT(' ?Error 210. NRRY('I1')='I', should = 'I2)

C-300-	With regular incremental DO's

	LOG = .TRUE.
	IVAR = 0
	DO I=1,4
		LOG = .NOT. LOG
		KNT = 0
		DO WHILE((LOG) .AND. KNT.LT.3)
			KNT = KNT+1
			DO J=1,5
				IVAR = IVAR + I + J
			ENDDO
		ENDDO
	ENDDO

	IF (IVAR .NE. 180) TYPE 300, IVAR
300	FORMAT(' ?Error 330. IVAR='I', should = 180')

C-400-	Let's fool the parser!
C	This should not be ANY type of DO loop or DOUBLE PRECSION stmt.

	DOU = 1

C-500-	This is a DO loop, the incr var is U.

	VAR=0
	DOU=1,2
	  VAR=VAR+1
	ENDDO

	IF (VAR .NE. 2) TYPE 500, VAR
500	FORMAT(' ?Error 500.  VAR='I', should = 3')

	STOP 'DoWhile'
	END