Re: lexical question

Subject: Re: lexical question
From: Len Olszewski <saslpo -at- UNX -dot- SAS -dot- COM>
Date: Tue, 29 Jun 1993 13:44:28 -0500


> What is the difference between a function, routine, and subroutine?


function - program or language element that, given values for
input parameters, returns a value.

routine - section of a program that executes out of line, such
that program control transfers to the routine until
its completion, and then returns to instruction
following the call to the routine.

subroutine - see routine.

You *call* a routine. You execute a function.

In some languages, functions can be a part of an expression, used in
place of the value you know they will return - unlike routines.
Also, in some languages, functions are recursive - you can use a
function in an expression that is an argument for the same function. I
don't think you can do that with routines, though I've been wrong
before. This, of course, is language dependent.

If I were you, I'd refer to the function without the parens. Our written
style calls for capitalizing language elements named in sentences, but
this is up to you. Show the parens, including however you choose to show
arguments or parameters, when you discuss syntax.

Most of the definitions, BTW, come from the _Dictionary of Computing_,
Oxford University Press, Second Edition. I rewrote some of the phrasing
(everybody is an editor) because MY way is better 8-). In spite of the
fact I have a credible source to cite (for a change), the gist of these
definitions agree with what I know about these terms in common usage.
Not that common usage is anything to hold as a standard. Neither is what
I know, although this covers less territory than what I *don't* know.

Good luck,

|Len Olszewski, Technical Writer |"I may be banal, but I'm not |
|saslpo -at- unx -dot- sas -dot- com|Cary, NC, USA| juvenile." - Yours Truly |
|---------------------------------------------------------------------|
| Opinions this ludicrous are mine. Reasonable opinions will cost you.|


Previous by Author: Re: creativity . . . and ethics
Next by Author: Re: lexical question - recursion, capitalizing names
Previous by Thread: Re: lexical question
Next by Thread: Re: lexical question


What this post helpful? Share it with friends and colleagues:


Sponsored Ads