- Fortran - Debugging Program
- Fortran - Programming Style
- Fortran - Program Libraries
- Fortran - Numeric Precision
- Fortran - Intrinsic Functions
- Fortran - Modules
- Fortran - Procedures
- Fortran - File Input Output
- Fortran - Basic Input Output
- Fortran - Pointers
- Fortran - Derived Data Types
- Fortran - Dynamic Arrays
- Fortran - Arrays
- Fortran - Strings
- Fortran - Characters
- Fortran - Numbers
- Fortran - Loops
- Fortran - Decisions
- Fortran - Operators
- Fortran - Constants
- Fortran - Variables
- Fortran - Data Types
- Fortran - Basic Syntax
- Fortran - Environment Setup
- Fortran - Overview
- Fortran - Home
Fortran Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Fortran - Programming Style
Programming style is all about following some rules while developing programs. These good practices impart values pke readabipty, and unambiguity into your program.
A good program should have the following characteristics −
Readabipty
Proper logical structure
Self-explanatory notes and comments
For example, if you make a comment pke the following, it will not be of much help −
! loop from 1 to 10 do i = 1,10
However, if you are calculating binomial coefficient, and need this loop for nCr then a comment pke this will be helpful −
! loop to calculate nCr do i = 1,10
Indented code blocks to make various levels of code clear.
Self-checking codes to ensure there will be no numerical errors pke spanision by zero, square root of a negative real number or logarithm of a negative real number.
Including codes that ensure variables do not take illegal or out of range values, i.e., input vapdation.
Not putting checks where it would be unnecessary and slows down the execution. For example −
real :: x x = sin(y) + 1.0 if (x >= 0.0) then z = sqrt(x) end if
Clearly written code using appropriate algorithms.
Spptting the long expressions using the continuation marker ‘&’.
Making meaningful variable names.