Q:

Selecting all elements from a fortran array except one

Suppose I have a 1D array, for example, A(1:10) and I want to do an operation on all the elements of this array except the 3rd element (let's say).  How can I skip this element while doing an operation?  A(1:10)=2*A(1:10) will multiply all the elements of this array with 2 but suppose I don't want to multiply the 3rd element by 2.  How do I do that in Fortran? 

A:

As others replies have pointed out, there are several ways to accomplish that, but the option I like the most hasn't been listed, i.e., using a FORALL statement: 
forall (i=1:10,i/=3) A(i)=2*A(i)

For some reason, this is becoming obsolescent in Fortran 2018, but I believe it's the most clear, concise and vectorizable way to get what you need. 
Another concise way to do that would be if you have a pure array index function stored somewhere else, like: 
pure function arrayI(n) result(indices)
   integer, intent(in) :: n
   integer :: indices(n),i   
   forall(i=1:n) indices(i)=i
end function arrayI

and then solve your problem with a single line of code like
where (arrayI(10)/=3) a=2*a

