Fortran arrays are column-major. a(i,j) and a(i+1,j) are neighbours in memory. a(i,j+1) is a whole column away. So the loop nest that walks memory in order has j outside and i inside.
Write it the C way round and the answer is still right. The code just strides through memory a column length at a time. Compilers can interchange loops when they can prove it's safe. Don't rely on it.
Sections follow the same rule. a(:,j) is contiguous. a(i,:) is not, and passing it to a procedure whose dummy argument is explicit-shape or assumed-size can force a copy in and a copy out. An assumed-shape dummy declared (:) takes the strided section as it is.
Whole-array expressions such as b = 2.0 * a leave the order to the compiler. Use them when the operation is elementwise.
Representation first. Sometimes a transposed copy made once is cheaper than a clever traversal done many times.