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: ```lualocal function has_cycles(x) local o, e = pcall(textutils.serialise, x) return not o and e:match "recursive"end```
gollark: Well, if you want to know just for serializing things, you can just `pcall` textutils.serialise.
gollark: Changes I made:- check reactor methods in the loop- make the only thing in the `if` statement be setting `txt`, so that it runs the rest of the code for *both*- pass `print` multiple parameters, since it can use that happily- inline calls to stuff- `term` calls directly instead of `shell.run "clear"`, which is mildly more efficient- indentation
gollark: Here is the fixed version.
gollark: ```lualocal r = peripheral.wrap("back")while true do term.clear() term.setCursorPos(1, 1) local txt if r.getActive() then txt = "Aktiv" else txt = "Inaktiv" end print("Der Reaktor ist", txt) print(r.getEnergyStored(), "RF gespeichert") sleep(1)end```

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.