Darima Lamazhapova wrote:
>
> Hello!
> I'm novice in FORTRAN, and also I don't know is my question is suitable
> here. My question concerns good programming style. I was taught that
> GOTO operator is an obsolescence and should not be used. But in many
> fortran programs I meet GOTO very often (e.g. to organize the cycle
> using IF construction). Does the good style of FORTRAN programs allow
> using operator GOTO?
> Darima.
> mailto: [log in to unmask]
With FORTRAN 77 it was nearly impossible to avoid GOTO statements. FORTRAN 90 introduced new constructs (DO WHILE, EXIT, CYCLE,...) that should allow to write "GOTO free" programs.
As a general rule, GOTO should now be avoided. However there are still some (few) exceptions where using GOTO makes life easier and may even be more readable than other constructs.
Pierre
--
+-----------------------------------+----------------------------+
| Pierre Hugonnet | mail....CGG |
| | 1, rue Leon Migaux |
| R&D Data Processing | 91341 MASSY cedex |
| | FRANCE |
| COMPAGNIE GENERALE DE GEOPHYSIQUE | phone...(33) 164 47 45 59 |
| Paris Processing Centre | fax.....(33) 164 47 32 49 |
| http://www.cgg.com | [log in to unmask] |
+-----------------------------------+----------------------------+
My opinions are not necessarily those of CGG
--------------------------------------------------------------------------------
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|