How do you iterate over an array in fortran?

really simple question.

say that I have

real, dimension(0:100) :: realResults 

and I want to iterate over realResults, eventually create json from a form array

 [[x1,y1], [x2,y2], [x3, y3], ... ] 

I'm sure I want to use "make", but I'm not sure how

thanks

+7
json fortran
source share
2 answers

In Fortran 90, you can iterate through an array, for example:

 do i = lbound(realResults), ubound(realResults) ! do something with realResults(i) end do 
+6
source share

FORTRAN and json in the same paragraph?!?! WTF? Maybe something like:

  do 10 i = 0, 100 C do something with realResults(i) 10 continue 
+1
source share

All Articles