# "Tips for golfing in Fortran" on stackexchange

**URL:** <https://fortran-lang.discourse.group/t/tips-for-golfing-in-fortran-on-stackexchange/9246>\
**Category:** Uncategorized\
**Created:** [February 24, 2025, 9:50pm UTC](https://fortran-lang.discourse.group/t/tips-for-golfing-in-fortran-on-stackexchange/9246 "2025-02-24T21:50:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nbehrnd](https://avatars.discourse-cdn.com/v4/letter/n/e0b2c6/32.png) [@nbehrnd](https://fortran-lang.discourse.group/u/nbehrnd)\
**Post date:** [February 24, 2025, 9:50pm UTC](https://fortran-lang.discourse.group/t/tips-for-golfing-in-fortran-on-stackexchange/9246/1 "2025-02-24T21:50:17Z")

</div>

On [https://codegolf.stackexchange.com/](https://codegolf.stackexchange.com/), the interested can submit their solution to a computational problem designed maximize the action/the results with minimal source code. Sometimes, the posts there are condensed on expense of readability…

Displayed a _hot network question_ (by the metrics of stackexchange), yesterday, a thread about [Tips for golfing in Fortran](https://codegolf.stackexchange.com/questions/278355/tips-for-golfing-in-fortran) started. Given there is some popularity in _one-liners_ for Perl, AWK, Python etc. (sometimes even published, e.g. [Python](https://nostarch.com/pythononeliners)), maybe regulars of our site would like to add and share a particularly _compact_ motif of (contemporary) Fortran there.

---

<div class="post-metadata">

**Author:** ![Shahid](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/shahid/32/3672_2.png) [@Shahid](https://fortran-lang.discourse.group/u/Shahid)\
**Post date:** [February 25, 2025, 7:09am UTC](https://fortran-lang.discourse.group/t/tips-for-golfing-in-fortran-on-stackexchange/9246/2 "2025-02-25T07:09:50Z")

</div>

People seem to be busy with FORTRAN77 loop structure. Using modern `DO CONCURRENT` we can do it in a single line for both serial and parallel (after using locality specification):

**Fortran2008**

```auto
do concurrent (i=1:Nx,j=1:Ny)
  ...
end do

```
