For this reason, the developers of the original Fortran language decided to make data declaration implicit. Instead of having to explicitly declare the type of a variable
INTEGER :: x
you could simply use it in your program, and the compiler would decide it was either an integer or a real number, based on the first letter of the variable name: if it started with I, J, K, L, M or N, it was assumed to be an integer, but if it started with any other letter, it was assumed to be a real.
Unfortunately, this feature can lead to all kinds of trouble, because it's a common mistake to mistype a character of a variable name. So, while you might mean one variable, you'd end up using another.
Here's an example:
% cat ruin.f90 PROGRAM ruin INTEGER :: bankrupt = 1 bankrpt = bankrupt - 1 IF (bankrupt > 0) THEN PRINT *, 'Bankrupt!' ELSE PRINT *, 'Whew!' END IF END PROGRAM ruin % f90 -o ruin ruin.f90 % ruin Bankrupt!
Notice that, in this program, we have a statement that says
bankrpt = bankrupt - 1
The variable on the left hand side of the equals sign in this assignment statement is bankrpt, not bankrupt; that is, it's missing the u. So, what we want is for the value of bankrupt to change from 1 to 0, in which case our company won't go bankrupt. But because of the typo, that doesn't happen, and so we do go bankrupt.
Now, suppose we add into our program the IMPLICIT NONE statement.
% cat dontruin.f90 PROGRAM dontruin IMPLICIT NONE INTEGER :: bankrupt = 1 bankrpt = bankrupt - 1 IF (bankrupt > 0) THEN PRINT *, 'Bankrupt!' ELSE PRINT *, 'Whew!' END IF END PROGRAM dontruin % f90 -o dontruin dontruin.f90 f90: Error: dontruin.f90, line 4: This name does not have a type, and must have an explicit type. [BANKRPT] bankrpt = bankrupt - 1 --------^
This time, the compiler catches the typo, so we can fix our program and avert disaster.