The earliest such languages I can find are FORTRAN II and ALGOL 58, both published in the same year 1958; though the original FORTRAN (1956) can arguably also be included.
For FORTRAN, the first page of the manual chapter covering functions contains this example (p. 27):
FUNCTION AVRG (ALIST, N)
DIMENSION ALIST (500)
SUM = ALIST (1)
DO 10 I=2, N
SUM = SUM + ALIST (I)
AVRG = SUM / FLOATF (N)
RETURN
END (2, 2, 2, 2, 2)
FORTRAN II also includes another function syntax (p. 10), the single-line function definition, inherited from its prececessor:
FIRSTF(X) = A*X + B
It’s not hard to see how the former syntax is a natural extension of the latter, in turn coming from mathematical usage.
ALGOL 58, similarly to FORTRAN, defines both single-line ‘functions’:
A function declaration declares a given expression to be a function of certain of its variables. Thereby, the declaration gives (for certain simple functions) the computing rule for assigning values to the function (cf. functions) whenever this function appears in an expression.
Form: Δ ~ In (I, I, ~, I) := E where the I are identifiers and E is an expression which, among its constituents, may contain simple variables named by identifiers appearing in the parentheses.
and ‘procedures’, equivalent to a today’s definition of function (in imperative/procedural programming languages, at least). The return value is indicated as follows (p. 19):
For each single output procedure I(Pi) listed in the heading, a value must be assigned within the procedure by an assignment statement “I := E” where I is the identifier naming that procedure.
These syntaxes were later taken up by some dialects of BASIC (in the form of DEF FN
and later FUNCTION
) and ALGOL’s descendant Pascal: in Borland’s Pascal compilers, assigning to the function name was the only supported syntax before the introduction of the Result
variable in Delphi 1.0.
It is probably Pascal that the mentioned commenter remembered; some universities still teach programming in it, and usually stick to the original, standard variety, instead of modern extended dialects like Object Pascal. (This isn’t really part of the question, but I’d assume the StackOverflow asker’s misunderstanding came from that as well.)