problem with goto


Feynman
09-10-2007, 08:57 AM
I write a program to beter see the comand goto;
It is a program read a number X , till X is less than 0 then it is invalid, so where is the problem in my code? where is the error?

code:
program GO TO
implicit none
10 print*,'entrer la valeur de X'
read* ,X
IF(X.LT. 0) then
print*,'INvalide'
GO TO 10
else
print*,'valide'
END IF
END

Skif
07-27-2008, 12:27 PM
Yuo must change the name of program
you as used "Implicic none" then all variable must be declared

for exemple

program pippo
implicit none
real*8 X
10 print*,'entrer la valeur de X'
read(*,*) X
IF(X.LT. 0) then
print*,'INvalide'
GO TO 10
else
print*,'valide'
END IF
END

hi!!