Tutorial by Examples

As an example of writing input & output, we'll take in a real value and return the value and its square until the user enters a negative number. As specified below, the read command takes two arguments: the unit number and the format specifier. In the example below, we use * for the unit number...
A modern Fortran example which includes error checking and a function to get a new unit number for the file. module functions contains function get_new_fileunit() result (f) implicit none logical :: op integer :: f f = 1 do ...
Where command line arguments are supported they can be read in via the get_command_argument intrinsic (introduced in the Fortran 2003 standard). The command_argument_count intrinsic provides a way to know the number of arguments provided at the command line. All command-line arguments are read in ...

Page 1 of 1