Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple question, yet I cannot figure it out. Please help!

Status
Not open for further replies.

dv98908

Programmer
Oct 28, 2016
2
US
In other life, I did a lot of Fortran programming. I needed to write a simple program to do something and, for the life of me, I can't get it to work. I've checked on-line, but to no avail.

What I show first is the simple source code. What I show next is the compilation error. I've scaled down the code to really focus in on the error, but I can't understand the compilation error.



program abc
implicit none

integer i,x(2)

do x(1)=1,2
end do

end program abc
-----------------------------------------

[t7600 test]$ f95 inverse.for
inverse.for:6.6:

do x(1)=1,2
1
Error: Unclassifiable statement at (1)
inverse.for:8.9:

end do
1
Error: Expecting END PROGRAM statement at (1)
------------------------------------------


Anything someone can do to help here would be appreciated.

Thank you,

DV

 
You tried to use array element x(1) as do-loop-variable. Use simply integer variable i and it will work:
Code:
program abc
  implicit none

  integer i,x(2)

  [highlight]do i=1,2[/highlight]
  end do

end program abc
 
Okay. I can figure it out from here. I didn't realize that using array elements were not allowed.

Thank you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top