Scorpio News |
January–March 1987 – Volume 1. Issue 1. |
Page 21 of 63 |
---|
This is normally used as the terminator of a DO loop. Although it is classified as an executable statement it really does nothing. It is very useful if the normal terminator of a DO loop is one of the forbidden statements (GOTO, STOP etc.)since it allows the successful completion of the loop before control is logically transferred to the next line of the program. In the above example, statement label 14 could be altered to:
PROD=PROD + A(I) 14 CONTINUE IF(PROD) 24,56,71 71 WRITE(5,100) PROD . . etc.
In this case control is passed to 71 and the value of PROD is printed if it is greater than 0.0; otherwise control is passed to another part of the program.
This is always the last statement in a Fortran program and its execution causes control to be passed to the system exit routine and thence to CP/M; it has the form:
END
and may have, optionally, a statement number.
This article was not intended to teach prospective users how to use Fortran, but to give intending users some idea of the way in which it can be used. A couple of books are worth mentioning which will give a more comprehensive coverage of the language. Wainwright and Grant’s contribution is quite handy since it treats BASIC and Fortran in parallel (there is a similar book for BASIC and Pascal) but the book is poorly produced by Babani and includes a simple Fortran ‘interpreter’ written in Spectrum BASIC – a nasty bit of work with many errors. Alrock’s book is in the same mould as his original book on BASIC and is well worth getting if you like his style. I recommend it to all my students since it is infinitely more readable chan the majority of so-called text books on Fortran.
Alcock, D, (1983) Understanding Fortran. Cambridge Univ. Press.
Wainwright, S.J end Grant, A. (1984) BASIC and Fortran in parallel. Babani.
Page 21 of 63 |
---|