Running this program will cause it to stop, print an error message, and exit with a non-zero status.
When the first stop statement is executed, the program exits without reaching the rest of the code. If you’d like to see the program try to create a temp file, comment out the first stop statement.
Note that unlike some languages which use exceptions for handling of many errors, in Fortran it is idiomatic to use error-indicating return values (like iostat) wherever possible.
In Fortran, there isn’t a direct equivalent to Go’s panic and recover mechanism. The stop statement is used for abrupt program termination, but it doesn’t provide the same level of control as Go’s panic. For more controlled error handling, Fortran programmers typically use status codes, error flags, or custom error handling routines.