I'm trying to write a program which contains a lot of else if statements. However, I cannot understand where this error is coming from. Any help would be appreciated.
Below is the if block I currently have:
if (i == 1 .AND. j==1) then
E = E + A(i+1,j) + A(i,j+1) + A(L,j) + A(i,L)
else if (i == 1 .AND. j==L) then
E = E + A(i,j-1) + A(i+1,j) + A(i,1) + A(L,j)
else if (i == L .AND. j == 1) then
E = E + A(i,j+1) + A(i-1,j) + A(1,j) + A(i,L)
else if (i == L .AND. j == L) then
E = E + A(i,j-1) + A(i-1,j) + A(1,j) + A(i,1)
else if (i == 1 .AND. 1 < j < L) then
E = E + A(i+1,j) + A(i,j+1) + A(i,j-1) + A(L,j)
else if (i == L .AND. 1 < j < L) then
E = E + A(i-1,j) + A(i,j+1) + A(i,j-1) + A(1,j)
else if (1 < i < L .AND. j == 1) then
E = E + A(i-1,j) + A(i+1,j) + A(i,j+1) + A(i,L)
else if (1 < i < L .AND. j == L) then
E = E + A(i-1,j) + A(i+1,j) + A(i,j-1) + A(i,1)
else
E = E + A(i-1,j) + A(i+1,j) + A(i,j-1) + A(i,j+1)
end if
The error that keeps coming up is:
Ising.f90:56:15:
else if (i == 1 .AND. 1 < j < L) then
1
Error: Unexpected junk after ELSE statement at (1)
Ising.f90:59:15:
else if (i == L .AND. 1 < j < L) then
1
Error: Unexpected junk after ELSE statement at (1)
Ising.f90:62:15:
else if (1 < i < L .AND. j == 1) then
1
Error: Unexpected junk after ELSE statement at (1)
Ising.f90:65:15:
else if (1 < i < L .AND. j == L) then
1
Error: Unexpected junk after ELSE statement at (1)
Aucun commentaire:
Enregistrer un commentaire