Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to repeat the IF statement

Status
Not open for further replies.

260791

MIS
Jun 14, 2010
16
GB
if (ratio < 0.2) then

WRITE(*,*) "We need mixing."
WRITE(*,*)"Please enter the data:"
WRITE(*,*)
WRITE(*,*)"Mix:"
READ(*,*)mix
WRITE(*,*)
WRITE(*,*)"Diameter:"
READ(*,*)diameter
WRITE(*,*)

WRITE(*,*)"At the flow",aflowrate(1),"m3/hr, pressure is ",ac1c2(1)
WRITE(*,*)"At the flow",aflowrate(2),"m3/hr, pressure is ",ac1c2(2)


else
WRITE(*,*) "The end"
endif


In the "IF then" block I'd like to add "TRY AGAIN?" and if the user wants to try again, it will go back to the beginning of everything and he can input new values.

What statement do I need to use (Fortran 90/95) to go back to the beginning of IF ?

Thanks
 
Looks like homework, but okay

CHARACTER(1) :: TryAgain

TryAgain='Y'
DO WHILE(TryAgain=='Y'.OR.TryAgain=='y')
Your code
WRITE(*,*)'Try Again?'
READ(*,*)TryAgain
END DO
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top