谁发明了 switch 语句?

Who invented the switch statement?

Switch 语句目前以所有主要语言(Javascript、Java、PHP、C#、C++、C)提供,但此语句在哪种语言中适用于第一次出现?

在您所指的语言中,C 可能是第一个。然而,如果你仔细观察,这个概念来自更基本的语言,例如汇编语言,

它真的无法回答,因为它是一个概念的演变。 C(你列表中最老的)是从 B(也有 switch)演变而来的,它是从 BCPL(有 switchon 语句)演变而来的。 BCPL 来自 CPL,而 CPL(AFAIK)不是。在 Pascal-vs-C 峡谷的另一边,ALGOL(在 ALGOL68 中有 case 语句)从 FORTRAN(在计算的 GO TO 语句中有一个基本的前身)演变而来。计算的 GO TO 非常低级,很容易在汇编中实现。

Lisp 有 cond,其中 Wikipedia's source 位于 1956-1958 年的时间范围内。

I invented conditional expressions in connection with a set of chess legal move routines I wrote in FORTRAN for the IBM 704 at M.I.T. during 1957-58...A paper defining conditional expressions and proposing their use in Algol was sent to the Communications of the ACM but was arbitrarily demoted to a letter to the editor, because it was very short.

-- John McCarthy: Lisp Prehistory - Summer 1956 through Summer 1958