# Fortran in 100 Seconds

**URL:** <https://fortran-lang.discourse.group/t/fortran-in-100-seconds/3718>\
**Category:** Uncategorized\
**Created:** [June 10, 2022, 5:40pm UTC](https://fortran-lang.discourse.group/t/fortran-in-100-seconds/3718 "2022-06-10T17:40:43Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![Beliavsky](https://avatars.discourse-cdn.com/v4/letter/b/ba8739/32.png) [@Beliavsky](https://fortran-lang.discourse.group/u/Beliavsky)\
**Post date:** [June 10, 2022, 5:40pm UTC](https://fortran-lang.discourse.group/t/fortran-in-100-seconds/3718/1 "2022-06-10T17:40:43Z")

</div>

YouTube video just posted [here](https://www.youtube.com/watch?v=NMWzgy8FsKs) at the Fireship channel, which has 1.36e6 subscribers. In 3 hours, the video already has 42K views, 5K likes, and 300+ comments.

> Topics Covered
> 
> - History of Programming Languages
> - When was Fortran invented?
> - Who created Fortran
> - Is Fortran still used?
> - Fortran basics tutorial
> - What is Fortran used for?

The author uses the .f95 extension for the short code presented, unfortunately (better is .f90 to signify free source form). He spends some time explaining implicit typing and the need for implicit none. Removing implicit typing has been much discussed here. The language is spelled FORTRAN in the video title. I wish he had mentioned that modern Fortran has array operations, like Matlab.

I discussed the author’s other videos [here](https://fortran-lang.discourse.group/t/language-marketing-for-julia-compared-to-fortran/3309/87).

---

<div class="post-metadata">

**Author:** ![gnikit](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/gnikit/32/1213_2.png) [@gnikit](https://fortran-lang.discourse.group/u/gnikit)\
**Post date:** [June 10, 2022, 7:32pm UTC](https://fortran-lang.discourse.group/t/fortran-in-100-seconds/3718/2 "2022-06-10T19:32:37Z")

</div>

I guess us releasing today v3.1.0 of Modern Fortran for VS Code was appropriately timed!

---

<div class="post-metadata">

**Author:** ![fortran4r](https://avatars.discourse-cdn.com/v4/letter/f/9de0a6/32.png) [@fortran4r](https://fortran-lang.discourse.group/u/fortran4r)\
**Post date:** [June 10, 2022, 8:16pm UTC](https://fortran-lang.discourse.group/t/fortran-in-100-seconds/3718/3 "2022-06-10T20:16:27Z")

</div>

> [@Beliavsky](#):
>
> The author uses the .f95 extension for the short code presented, unfortunately (better is .f90 to signify free source form).

I personally prefer .f95, any reason why .f90 is better?

---

<div class="post-metadata">

**Author:** ![Beliavsky](https://avatars.discourse-cdn.com/v4/letter/b/ba8739/32.png) [@Beliavsky](https://fortran-lang.discourse.group/u/Beliavsky)\
**Post date:** [June 10, 2022, 8:32pm UTC](https://fortran-lang.discourse.group/t/fortran-in-100-seconds/3718/4 "2022-06-10T20:32:37Z")

</div>

My reasons are given in the thread [Is there a "standard" file suffix for modern Fortran code?](https://fortran-lang.discourse.group/t/is-there-a-standard-file-suffix-for-modern-fortran-code/3550)

---

<div class="post-metadata">

**Author:** ![fortran4r](https://avatars.discourse-cdn.com/v4/letter/f/9de0a6/32.png) [@fortran4r](https://fortran-lang.discourse.group/u/fortran4r)\
**Post date:** [June 10, 2022, 9:51pm UTC](https://fortran-lang.discourse.group/t/fortran-in-100-seconds/3718/5 "2022-06-10T21:51:06Z")

</div>

It seems that among the Fortran compilers only ifort does not recognize the .f95 file extension, but this issue can be easily handled:  
[Switch to allow ifort v8.0 to recognise \*.f95 files - Intel Communities](https://community.intel.com/t5/Intel-Fortran-Compiler/Switch-to-allow-ifort-v8-0-to-recognise-f95-files/td-p/760765).

As such, I guess there is no problem using the .f95 file extension.

---

<div class="post-metadata">

**Author:** ![Pap](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/pap/32/1305_2.png) [@Pap](https://fortran-lang.discourse.group/u/Pap)\
**Post date:** [June 10, 2022, 9:53pm UTC](https://fortran-lang.discourse.group/t/fortran-in-100-seconds/3718/6 "2022-06-10T21:53:49Z")

</div>

The only problem with that video is… the 100 seconds. You can only scratch the very tip of the iceberg, and that only by speaking as fast as he does in the video. Inevitably, the past of the language takes over the majority of the extremely limited time available, since Fortran has a long history and you can’t just skip that.  
Nevertheless the fact this video got many views and likes that fast is refreshing. And perhaps the fact it’s that short helped some people to a least hear about the reason terms like “high level programming language” and “compiler” were invented.

As for the file extension, I recently reluctantly adopted .f90 realizing the fact changing suffix every time a new standard is released leads nowhere, and .f90 is the de facto standard nowadays.

---

<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:** [June 10, 2022, 10:06pm UTC](https://fortran-lang.discourse.group/t/fortran-in-100-seconds/3718/7 "2022-06-10T22:06:03Z")

</div>

Maybe the author is used to Python where one may define and use variables «on the fly», but the example to loop with

```fortran
program myApp

   implicit none

   do n = 1, 10
      doubled = n*2
      print *, doubled
   end do

end program myApp

```

won’t work.

![loops](https://global.discourse-cdn.com/free1/uploads/fortran_lang/original/2X/b/be4e48f01461bdb3877d267d860bb5e4ba59e755.png)

---

<div class="post-metadata">

**Author:** ![ashe](https://avatars.discourse-cdn.com/v4/letter/a/ce73a5/32.png) [@ashe](https://fortran-lang.discourse.group/u/ashe)\
**Post date:** [June 10, 2022, 10:09pm UTC](https://fortran-lang.discourse.group/t/fortran-in-100-seconds/3718/8 "2022-06-10T22:09:58Z")

</div>

> [@fortran4r](#):
>
> It seems that among the Fortran compilers only ifort does not recognize the .f95 file extension, but this issue can be easily handled:  
> [Switch to allow ifort v8.0 to recognise \*.f95 files - Intel Communities](https://community.intel.com/t5/Intel-Fortran-Compiler/Switch-to-allow-ifort-v8-0-to-recognise-f95-files/td-p/760765).
> 
> As such, I guess there is no problem using the .f95 file extension.

It should work correctly, but that thread explains why it’s not a great idea. As does the one linked by @Beliavsky.

---

<div class="post-metadata">

**Author:** ![RonShepard](https://avatars.discourse-cdn.com/v4/letter/r/a3d4f5/32.png) [@RonShepard](https://fortran-lang.discourse.group/u/RonShepard)\
**Post date:** [June 11, 2022, 2:05pm UTC](https://fortran-lang.discourse.group/t/fortran-in-100-seconds/3718/9 "2022-06-11T14:05:52Z")

</div>

Regarding file name extensions, in hindsight it is unfortunate that the chosen terms “fixed” and “free” both start with “f”. As is, an extension like \*.ff is somewhat ambiguous. If they had used some other synonyms for these, like “structured” and “unstructured”, then extensions like \*.sf and \*.uf might have worked. Ironically, the “free” form source code has more constraints on the programmer than the fixed form. Namely, spaces are **required** in many contexts in free form, keywords **cannot** have embedded spaces (with a few exceptions like enddo, endif, etc.) and literal constants **cannot** have spaces (1 234 567 890). In fixed form none of those constraints apply, and there is instead the column fields 1-5, 6, 7-72, 73-80 that have special meaning.

However, given the history and usage in the language, \*.f and \*.f90 seem adequate.

It is unfortunate that the video uses \*.f95, which is mostly just confusing since there have been numerous language revisions since the 1995 standard, no one really programs using the f95 standard anyway, and actual usage of the \*.f95 extension is rare.

---

<div class="post-metadata">

**Author:** ![wyphan](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/wyphan/32/632_2.png) [@wyphan](https://fortran-lang.discourse.group/u/wyphan)\
**Post date:** [June 11, 2022, 5:49pm UTC](https://fortran-lang.discourse.group/t/fortran-in-100-seconds/3718/10 "2022-06-11T17:49:24Z")

</div>

No, it won’t work due to `implicit none`.

---

<div class="post-metadata">

**Author:** ![ashe](https://avatars.discourse-cdn.com/v4/letter/a/ce73a5/32.png) [@ashe](https://fortran-lang.discourse.group/u/ashe)\
**Post date:** [June 11, 2022, 6:12pm UTC](https://fortran-lang.discourse.group/t/fortran-in-100-seconds/3718/11 "2022-06-11T18:12:31Z")

</div>

What does `implicit none` have to do with using `.f95` as the file extension?

---

<div class="post-metadata">

**Author:** ![wyphan](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/wyphan/32/632_2.png) [@wyphan](https://fortran-lang.discourse.group/u/wyphan)\
**Post date:** [June 11, 2022, 6:15pm UTC](https://fortran-lang.discourse.group/t/fortran-in-100-seconds/3718/12 "2022-06-11T18:15:37Z")

</div>

No, the problem is not with `.f95` file extension, but `implicit none` forcing you to declare `integer :: n, doubled`, which is why the sample code wouldn’t work. Unless `implicit none` is removed, then `n` is automatically an `integer` type, and `doubled` is automatically `real` type.

Edit: just realized I meant to reply to [Fortran in 100 Seconds - #7 by nbehrnd](https://fortran-lang.discourse.group/t/fortran-in-100-seconds/3718/7) instead of your comment [Fortran in 100 Seconds - #8 by ashe](https://fortran-lang.discourse.group/t/fortran-in-100-seconds/3718/8) , my bad

---

<div class="post-metadata">

**Author:** ![FortranFan](https://avatars.discourse-cdn.com/v4/letter/f/96bed5/32.png) [@FortranFan](https://fortran-lang.discourse.group/u/FortranFan)\
**Post date:** [June 11, 2022, 6:39pm UTC](https://fortran-lang.discourse.group/t/fortran-in-100-seconds/3718/13 "2022-06-11T18:39:23Z")

</div>

If only the Fortran standard can [**eliminate implicit mapping**](https://fortran-lang.discourse.group/t/eliminate-implicit-mapping/1612), the `IMPLICIT NONE` would no longer be necessary for safe coding.

There will be no need to bring up the legacy of integer types with `I-N`, etc. and

**10+ seconds** can be better utilized in such a 100 second **“elevator pitch”** to tout the better features of Fortran. Alas …

Sigh 😧

---

<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:** [June 11, 2022, 8:46pm UTC](https://fortran-lang.discourse.group/t/fortran-in-100-seconds/3718/14 "2022-06-11T20:46:24Z")

</div>

Of course, in such a brief video, only little can be shown. It is an appetizer for the language _in general_ and not a class like e.g., the by [Derek Banas](https://www.youtube.com/watch?v=__2UgFNYgf8). Though one may argue if the video caption already links to fortranwiki, an additional (prominent) link to [fortran-lang.org](http://fortran-lang.org) or an additional slide with points of entry to the language were beneficial. Some of the commenters of the video indeed mention interest or/and a need to learn Fortran.

Yet regardless how constraint the examples advertising a language are, they must represent a benefit for the interested; else, they likely move on to the next. E.g. (with cheerful smile), a vim cup

![vim_mug](https://global.discourse-cdn.com/free1/uploads/fortran_lang/original/2X/1/1b448907d5c31633d57361dc076a6e93d6b0c568.png)

(image credit to [zazzle.com](https://www.zazzle.com/vim_cheat_sheet_coffee_mug-168614566572345975))

For examples depicting code, my anticipations are that

1. these work when applied verbatim just as one is asked to provide a [MWE](https://en.wikipedia.org/wiki/Minimal_reproducible_example) addressing a question in a discussion. So not something like Amazon’s _Fortran notebook_ mentioned earlier by Ivan ([here](https://fortran-lang.discourse.group/t/modern-fortran-logo/2075/4)). At present, the do loop in the short video does not meet this criterion.

2. that they reflect _contemporary_ custom e.g., in terms of the syntax. Once some insight is accumulated, on still can gain additional one by looking into earlier approaches, learn to read and maintain source code inherited. Possibly because Fortran provides better backward compatibility across standards than e.g., Python 2 vs. Python 3, there still are beginner classes teaching Fortran as FORTRAN 77:

Anticipations don’t always match realizations.

---

<div class="post-metadata">

**Author:** ![FortranFan](https://avatars.discourse-cdn.com/v4/letter/f/96bed5/32.png) [@FortranFan](https://fortran-lang.discourse.group/u/FortranFan)\
**Post date:** [June 11, 2022, 8:47pm UTC](https://fortran-lang.discourse.group/t/fortran-in-100-seconds/3718/15 "2022-06-11T20:47:50Z")

</div>

> [@nbehrnd](#):
>
> but the example to loop with  
> …  
> won’t work.

I’ve left a comment tor the creator to use an example that works and one that conveys a tad more in order to make it worth the ~10 seconds it takes up, sure to be ignored is the following:

```fortran
   integer :: n
   do n = 1, 10
      ! Factorial of n
      print "(i2,'! = ',g0)", n, product([( i, integer :: i=1,n )])
   end do
end

```

---

<div class="post-metadata">

**Author:** ![fortran4r](https://avatars.discourse-cdn.com/v4/letter/f/9de0a6/32.png) [@fortran4r](https://fortran-lang.discourse.group/u/fortran4r)\
**Post date:** [June 11, 2022, 10:23pm UTC](https://fortran-lang.discourse.group/t/fortran-in-100-seconds/3718/16 "2022-06-11T22:23:24Z")

</div>

> [@FortranFan](#):
>
> `[(i, integer :: i = 1, 5)]`

Is this implied do loop correct? I couldn’t run it on GFortran. If it is correct, then I am confused because I thought all variables need to be declared in the beginning. Also, does implicit saving apply here?

---

<div class="post-metadata">

**Author:** ![FortranFan](https://avatars.discourse-cdn.com/v4/letter/f/96bed5/32.png) [@FortranFan](https://fortran-lang.discourse.group/u/FortranFan)\
**Post date:** [June 12, 2022, 1:48pm UTC](https://fortran-lang.discourse.group/t/fortran-in-100-seconds/3718/18 "2022-06-12T13:48:44Z")

</div>

> [@fortran4r](#):
>
> Is this implied do loop correct?

Yes, starting Fortran 2018 revision, the `implied-do-control` where the construction of arrays are involved can be

```auto
[integer-type-spec ::] ac-do-variable = scalar-int-expr , scalar-int-expr [, scalar-int-expr]

```

---

<div class="post-metadata">

**Author:** ![FortranFan](https://avatars.discourse-cdn.com/v4/letter/f/96bed5/32.png) [@FortranFan](https://fortran-lang.discourse.group/u/FortranFan)\
**Post date:** [June 12, 2022, 1:55pm UTC](https://fortran-lang.discourse.group/t/fortran-in-100-seconds/3718/19 "2022-06-12T13:55:29Z")

</div>

> [@fortran4r](#):
>
> I am confused because I thought all variables need to be declared in the beginning. Also, does implicit saving apply here?

With `implied-do` in `DO CONCURRENT`, array construction, `FORALL` and `DATA` statements, the scope of the construct or the statement is what applies to the index (or the indices). The type-spec of the index or indices can thus accompany those constructs / statements.

Note **no** `implied SAVE` comes into play with the declaration of such index variables.
