Derived data type component as do loop index

I personally wouldn’t use a non-local do variable but the OP apparently has a reason. I have seen do variables saved in common blocks or local data statements in a lot of old code usually something like interpolation routines where you are trying to find the bounding interval for the desired interpolation value. Saving the index of the last found interval in a search to use in successive calls to the interpolation routines was standard practice.

1 Like