Material for Fortran lessons

All Fortran examples relevant for GEF4510 can be found here. You can start with basic examples:

  • affect.f90 : define some simple variables and set values
  • concat.f90 : show how to concatenate two strings in Fortran and why TRIM function shall be used.
  • construct_vector.f90: define simple arrays and use vector constructor to set values (/.../)
  • const_symbol.f90 : how to use PARAMETER attribute to define constants in your code
  • conv_implicit.f90 : demonstrate Fortran implicit conversion according to variable types (be careful with it as it can lead to errors in your code!)
  • expr_array.f90 : array expressions i.e. no need to loop over each value.
  • if_statement.f90: show a simple IF statement in Fortran
  • priority.f90 : show operator priorities in arithmetic or logical expressions. If unsure, use parenthesis!
  • selectcase.f90 : show how and when to use SELECT CASE statement instead of IF statement.

 

Published Aug. 26, 2016 8:39 AM