Arithmetic IF

The arithmetic IF statement is a three-way arithmetic conditional statement, first seen in the first release of Fortran in 1957, and found in all later versions[lower-alpha 1], and some other programming languages, such as FOCAL. Unlike the logical IF statements seen in other languages, the Fortran statement defines three different branches depending on whether the result of an expression is negative, zero, or positive, in said order, written as:

     IF (expression) negative,zero,positive

Depreciation

While it originally was the only kind of IF statement provided in Fortran, the feature has been used less and less frequently after the logical IF statements were introduced, and was finally labeled obsolescent in Fortran 90. As of Fortran 2018, it is no longer required for compilers to implement arithmetic IF and it is considered to be a deleted feature. The GNU Fortran compiler has been producing warnings for arithmetic IF by default since its 9.1 release in 2019.

gollark: Sorry, discord latency.
gollark: Because it's the coolest and best solution!
gollark: > are they thoyes.> 40 years for us to figure out mass recycling idkI mean, maybe, but you still have to go out to the deserts and replace all of them, and they'll slowly degrade in effectiveness before that.
gollark: I think because the main advantage was that it wouldn't produce neutrons in some sort of fusion reaction, and neutrons cause problems, except it still would because of the fuels each fusing with themselves.
gollark: I think I read somewhere that it wasn't very useful (he3) but i forgot why.

See also

Notes

  1. Might not be present in a Fortran 2018 compiler. See the Depreciation section.

References


    This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.