logoalt Hacker News

The 'else' keyword is probably a literal translation from German (2020)

105 points • by theanonymousone • last Sunday at 4:05 PM • 120 comments • view on HN

Comments

chrismorgan • today at 6:58 AM

The submitted title

> The 'else' keyword is probably a literal translation from German (2020)

is editorialised, inaccurate, and very misleading.

The actual title: “if … then … else had to be invented!”

And the content doesn’t say anything about it being a literal translation from German; rather:

> What they do say is that this document was originally written in German and hastily translated into English. I think a carefully-chosen German word was probably translated as an archaic English word and then never revisited.

Wild speculation, and definitely nothing about literality of translation.

As for the author’s description of it being archaic, well, I’d call that misleading too. Bare “else”, arguably (definitely not colloquial in most dialects), but as “or else”, perfectly current.

Seems perfectly reasonable to me that someone considered the options, decided “otherwise”, “or else” too wordy and confusing in its own way, and so settled on bare “else” as the best choice (which I think it is), not how people mostly speak, but perfectly legitimate, and concise.

(In other words: I think we’d have settled on “else” even without the possible German step. This too is speculation, of course.)

slu • today at 6:08 AM

Else is a given name in Denmark (a variation of Elsa, I'm guessing). At university we had a professor with the surname True; so if he had a daughter, her name could've been Else True. We found that quite funny.

Else If would also be a possible name in Denmark.

But, according to Statistics Denmark[1], none of those combinations exists:

Women with the first name 'Else' 13,047 Men and women with the last name 'True' 166 No one has the name 'Else True'

Women with the first name 'Else' 13,047 Men and women with the last name 'If' 6 No one has the name 'Else If'

[1] https://www.dst.dk/en/Statistik/emner/borgere/navne/hvor-man...

➕ show 2 replies
esperent • today at 5:55 AM

It's always "or else" when used as a conjunction in modern English.

"Take your coat or else you'll regret it."

"Hurry or else you'll miss the bus."

Etc.

> if something is true, then do a thing, else do a different thing.

> That's just English, right? Except that it isn't

No, it is English, grammatically correct English. It's not idiomatic English but it's a perfectly fine sentence otherwise.

Idiomatic English would simply require adding an or

    if(x)
        do m
    orelseif(y)
        do n
    orelse
        do o
But of course a native English programmer would quickly recognize the or is redundant even if it is idiomatic, and drop it.

> I think a carefully-chosen German word was probably translated as an archaic English word and then never revisited

This is a weird reach. Else isn't an archaic word.

"Eat your dinner or else."

"If you don't do it someone else will have to."

Plus all the "or else" conjunction examples.

It was probably chosen because it was shorter than "otherwise" and not for any other reason.

➕ show 1 reply
divbzero • today at 4:27 AM

‘Else’ is not commonly used in English today but the meaning does fit. From Webster’s (1913):

Else, adverb or conjunction

1. Besides; except that mentioned; in addition; as, nowhere else; no one else.

2. Otherwise; in the other, or the contrary, case; if the facts were different.

“For thou desirest not sacrifice; else would I give it.” – Ps. li. 16.

After ‘or’, else is sometimes used expletively, as simply noting an alternative. “Will you give thanks, … or else shall I?” – Shak.

➕ show 3 replies
parasec • today at 8:36 AM

wild speculation indeed. According to Google Book Ngrams, the word "else" has been used in english books as far back as the tool permits (1500s) and can be found everywhere - from books to state calendars.

akersten • today at 3:42 AM

> I can't use "else" as a conjunction in normal speech, only in computer programs.

sure you can. who's going to stop you?

➕ show 4 replies
stkdump • today at 4:03 AM

The modern universal keywords if, else, for and while are good because they are fairly short and thus quick to type.

➕ show 3 replies
lazyasciiart • today at 5:28 AM

This guy better figure out how to use English, or else something bad will happen.

zacharyvoase • today at 4:07 AM

it was probably a rote translation of the German word ‘sonst’

➕ show 3 replies
jibalt • today at 5:58 AM

I think the headline is nonsense.

I was going to mention the MAD language by Bernard Galler et. al. that used whenever/otherwise, which I encountered in a book in the local library back in the days when everyone was coming up with "structured" programming languages, but then I scrolled to the bottom of the article ...

pram • today at 4:20 AM

Don’t even get me started on “elif”

➕ show 2 replies
dvh • today at 8:20 AM

How would you mime "else" in charades?

deepsun • today at 5:40 AM

I remember it felt odd when XSLT code provided "otherwise" instead of "else".

rickdeckard • today at 6:41 AM

Nice article.

Funny enough, even though I know if..then..else by heart for decades now, I also spent a few seconds on that 1960 arrow diagram of ALGOL60...

bitwize • today at 4:09 AM

No. English has used else to mean "otherwise" since before computers came along. Wiktionary offers this quote from Call of the Wild (1903):

"He had never seen dogs fight as these wolfish creatures fought, and his first experience taught him an unforgetable lesson. It is true, it was a vicarious experience, else he would not have lived to profit by it."

https://en.wiktionary.org/wiki/else#Conjunction

There's also "or else", as made famous in crime dramas: "Meet me by the docks at midnight. Bring the money. Come alone. No cops... or else!" But in other usage it can of course be followed by something. "He had to get to work on time, or else he might be fired."

➕ show 1 reply
stavros • today at 8:55 AM

Every single comment I've seen here seems to miss that, in the UK, "else" is the preferred word to use in these contexts.

"We'd better hurry, else we'll be late", or "I could go to a pub, else we can just stay home" is exactly the correct UK usage.

I guess the UK largely isn't up yet, hence this sort of comment missing.

fcarraldo • today at 3:53 AM

If something were to be true, then foo.

Or if this other thing were to be true, then bar.

If it’s something else, then baz.

➕ show 1 reply
dwd • today at 6:31 AM

What about Kierkegaard?

He wrote Either/Or or Enten – Eller in Danish in 1843.

Else in Danish is Ellers.

➕ show 1 reply
andai • today at 5:32 AM

Some languages also have an "unless" keyword!

➕ show 1 reply
saintfire • today at 4:09 AM

Article states else is archiac English but later says someone called it ignorantly incorrect English and suggested using "or".

Ive always assumed it was effectively "otherwise" but shortened to "or else" -> "else".

Given the alternative to use "or" as the first pushback I feel that acts as confirmation. I prefer else because "or" has implications in boolean and bitwise logic that else doesn't.

raverbashing • today at 6:46 AM

Also, one thing that has been happening without much awareness in the history of computer languages: shorter identifiers win over long identifiers

Why not { } instead of begin and end?

def or fn over function/lambda (or just () => now)

Symbols are confusing at first but become practical after a bit

About TFA: Also 'if/or' would make people confuse logical or with bitwise or, so I guess that's why it was eschewed

wewewedxfgdf • today at 3:38 AM

The English language origin is from programming if/then/else

➕ show 1 reply
Frieren • today at 3:48 AM

If ... then ... otherwise ...

Fixed!

➕ show 2 replies
baggy_trough • today at 5:32 AM

Give up this mad idea, or else.

LocalH • today at 4:34 AM

what

xdennis • today at 4:08 AM

> I can't use "else" as a conjunction in normal speech, only in computer programs.

Not true. Here's an example from 1876 in which "else" is used as a conjunction.

> My brother is poor, and I want to look as much like him as I can, else he may feel distant from me.

-- George Eliot ( https://www.victorianlondon.org/etexts/eliot/deronda-0047.sh... )

---

Here's an example of "if ... else" from the 1914 translation of Crime and Punishment ( https://en.wikisource.org/wiki/Crime_and_Punishment/Part_IV/... ):

> Perhaps it will all come back, but now if you love me, give me up . . . else I shall begin to hate you, I feel it.

➕ show 2 replies
hommelix • today at 5:18 AM

Else can be found in English text prior to computer existence. Else can't be found in a German dictionary as a conjunction [1]. The first suggestion in Duden is the name for alder tree in lower German. Second suggestion is a firstname. If a word would come from German, it seems the first step would be to look up in a German dictionary.

While the look up for history of computer language is interesting, the conclusion is completely wrong.

[1] https://www.duden.de/suchen/dudenonline/Else

➕ show 2 replies