I'm unable to interpret a sentence though searched and read multiple explanations.

“GOD is real, unless declared integer.” a Fortran-based witticism

Real is real number,
What's the idioms it refers to ?

  • 72
    Fortran is a programming language, you need first to understand variable, real, integer and declare in the context of that language, and consider what type the variable GOD would be. You then move into amateur theology for the joke. – djna Apr 10 '18 at 13:39
  • 67
    Just to point out, most native English speakers wouldn't understand this joke at all without some programming knowledge, and even then they could only guess at the real meaning unless they were specifically familiar with FORTRAN, a language that was apparently invented 61 years ago. As an electrical engineer friend once told me, "If any of your courses try to teach you FORTRAN, run out of the room screaming." – Excrubulent Apr 11 '18 at 7:40

This has little to do with English language and usage: it is entirely to do with the conventions of Fortran, a computer programming language.

Fortran has two kinds of variables: Integer variables (that hold an integer number) and real variables (that hold a real number).

By default, any variable whose name begins with the letters I,J,K,L,M or N is integer, otherwise it is real. So a variable called GOD would by default be a "real variable" - in short, "GOD is real".

The joke is that this might be presented as an argument for the existence of God.

  • 138
    This explanation is excellent. However, I'm not sure the joke is so much that it might be presented as an argument for the existence of God, as it is that it sounds at first like it is intended as a solemn pronouncement that God exists but then turns out to be just a bit of word play. – Eliah Kagan Apr 10 '18 at 16:19
  • 2
    Comments are not for extended discussion; this conversation has been moved to chat. – snailplane Apr 11 '18 at 12:34
  • 2
    @EliahKagan Exactly. Many jokes rely on making a statement that leads the audience to think you are talking about one thing, and then suddenly making it apparent that you are talking about something else. Usually you start out making it sound like you are talking about something profound and/or important and then reveal you were really talking about something trivial. Or very commonly, start out making them think you're talking about sex and then, no, you're talking about something boring. – Jay Apr 12 '18 at 20:14
  • 1
    For this answer to be useful on this site, it should at least specify that Fortran is a computer programming language. The upvotes seem to come from stackexchange readers who've seen it on the hot questions list. However, the answer should stand on its own. – vsz Apr 16 '18 at 6:03
  • 1
    I'm a native English speaker who writes a lot of code and I still didn't understand this joke. Thank you! – Andrew Brēza Oct 25 '19 at 13:17

In computer programming, a value has a type. Two kinds of numeric types are real and integer.

Integers are only whole numbers. Reals are numbers with exponents and fractional parts (parts after a decimal point) accurate to a certain precision, so you can store, say, 3.1415926.

None of the above is specific to Fortran. What is specific to Fortran is that numeric variables can be real or integer, with real being the default, unless specifically declared to be integer (see also other answer about variables beginning with I,J,K,L,M or N defaulting to integer).

  • 8
    “specific to Fortran is that all variables are either real or integer”... um, Fortran is dumb, but it's not that dumb! It does have types other than real and integer. I'd say what's specific to Fortran is that despite being statically typed (and not supporting type inference), it permits variables to be used without any explicit type declaration. – leftaroundabout Apr 12 '18 at 14:56
  • 3
    Sorry, I meant to say all numeric variables are real or integer. And even then it's ignoring complex numbers. Edited to remove confusion. – thomasrutter Apr 12 '18 at 22:36
  • 1
    "Fortran allows implicit declaration of variables, just by using (assigning) the name. Their type (integer or real) is then inferred from their first letter of their name (I...N vs everything else)" – smci Apr 13 '18 at 3:47

Previous answers, though good, are not clear enough about types and declaration, in my humble opinion.

Most programming languages allow (or require) you to say, at the top of each program or subroutine, what variables you are going to use and what kind of data they will hold. The most common types are boolean (one bit), integer, real (now more usually called floating point), complex, character, string. Type matters because the same sequence of bits can be interpreted in all of these different ways, and thus represent different values.

When Fortran finds a sequence of characters (beginning with a letter) that is neither a reserved word (like IF) nor a declared variable, it will treat that string as the name of a variable, assigning it type INTEGER or REAL according to the first letter. Variables beginning with I through N are integers by default because these letters are conventionally preferred for use as indices to sequences: xk means the kth entry in sequence x.

(Fortran has a command, which I've forgotten, to change the defaults; if you're using a lot of COMPLEX variables, you might assign them the letters C,W,Z, which would otherwise default to REAL.)

So. If the command INTEGER GOD appears near the top, then the label GOD is assigned to a variable whose content will be processed as an integer; if not, and the word GOD appears elsewhere in the code, then the label GOD is assigned to a variable whose content will be processed as a floating-point number.

  • 10
    This is a Stack Exchange about learning English, not learning programming. I think the previous answers were plenty clear on types and declarations. You’ve taken a lot of the humor out of the original statement. – J.R. Apr 13 '18 at 9:40
  • To quote Housman; "Perfect understanding will sometimes almost extinguish pleasure." – copper.hat Apr 15 '18 at 3:33
  • -1: FORTRAN has no reserved words. – kevin cline Apr 15 '18 at 8:57
  • If there are no reserved words, perhaps someone can edit that passage to indicate how Fortran decides that a string is a new identifier rather than something else. – Anton Sherwood Apr 15 '18 at 23:08

The joke also plays on the 1886 statement attributed to mathematician Leopold Kronecker:

God made the integers, all else is the work of man.


Not the answer you're looking for? Browse other questions tagged or ask your own question.