我正在尝试在Fortran90中运行一些snipett代码,并且我使用while语句获得了一个未分类的语句错误。我已经在网上查找过,并且无法找到为什么会在while语句中出现这种情况。这是我得到的错误:
Test.f90:11.4:
while (R < MinimumEnergy) do
1
Error: Unclassifiable statement at (1)
Test.f90:15.8:
while (f < R) do
1
Error: Unclassifiable statement at (1)
Test.f90:19.11:
enddo
1
Error: Expecting END PROGRAM statement at (1)
Test.f90:23.7:
enddo
1
Error: Expecting END PROGRAM statement at (1)
这是我的代码:
program FD_Number
REAL :: MinimumEnergy = 4.5;
REAL :: a = -9;
REAL :: b = 9;
REAL R, randomN, f
REAL :: FD
FD(R) = (1 + exp(R))**(-1)
R = 0;
while (R < MinimumEnergy) do
R = 999999;
f = FD(a + (b - a)*R);
while (f < R) do
call random_number(randomN)
f = FD(a + (b - a)*randomN);
call random_number(R)
enddo
R = a + (b - a)*R;
f = FD(R);
enddo
print *, f
end
答案 0 :(得分:1)
我有代码
while (statement) do
code
enddo
而不是
identifier: do while (statement
code
end do identifier