What Does the Fortran Statement 'IF ( IP - I1 ) 180, 170, 180' Mean?

  • Context: Fortran 
  • Thread starter Thread starter agalya
  • Start date Start date
  • Tags Tags
    Fortran
Click For Summary
SUMMARY

The Fortran statement 'IF ( IP - I1 ) 180, 170, 180' is an example of an "arithmetic IF" statement. It directs the program's flow based on the result of the expression 'IP - I1'. Specifically, if 'IP - I1' is less than zero, the program jumps to statement 180; if it equals zero, it jumps to statement 170; and if it is greater than zero, it again jumps to statement 180. This construct is characteristic of older Fortran code, reflecting its historical usage in programming.

PREREQUISITES
  • Understanding of Fortran programming language syntax
  • Familiarity with control flow statements in programming
  • Knowledge of arithmetic operations and comparisons
  • Experience with legacy codebases
NEXT STEPS
  • Research the differences between arithmetic IF and logical IF statements in Fortran
  • Explore modern alternatives to arithmetic IF in contemporary programming practices
  • Learn about the history and evolution of the Fortran programming language
  • Examine best practices for maintaining and refactoring legacy Fortran code
USEFUL FOR

This discussion is beneficial for Fortran programmers, software maintainers dealing with legacy systems, and computer science students studying control flow in programming languages.

agalya
Messages
9
Reaction score
0
Hi all,

What is the meaning of the following Fortran statement

IF ( IP - I1 ) 180, 170, 180

kindly help,
thank u,
 
Technology news on Phys.org
This is an "arithmetic IF" statement.

If IP - I1 < 0, go to statement 180.
If IP - I1 = 0, go to statement 170.
If IP - I1 > 0, go to statement 180.

You must be reading very old code. :smile:
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 4 ·
Replies
4
Views
8K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
Replies
3
Views
2K
  • · Replies 16 ·
Replies
16
Views
4K
  • · Replies 6 ·
Replies
6
Views
2K