Function vs Procedure

P

Poseur

I sometimes see the experts here (and on m.p.excel.programming)
present helper routines as functions rather than procedures thus
assigning a variable in the caller to the function when that
variable is not necessary or used in the caller. Is there an
advantage to that?
 
W

Word Heretic

G'day Poseur <[email protected]>,

Generically speaking, Avoid Void's :) Wherever possible try to return
a useful value. Sometimes there is just no useful value to return,
sure.

BTW: Stricter languages like C demand you type all returns, so if
there is no useful return you use a datatype of Void which is the
datatype equivalent of NIL:

Steve Hudson - Word Heretic
Want a hyperlinked index? S/W R&D? See WordHeretic.com

steve from wordheretic.com (Email replies require payment)


Poseur reckoned:
 
H

Howard Kaikow

No.

In general, some folkes argue that every procedure should return a value
that can be used to test for success/failure,

It's a "religious" issue as some programming languages require that all
procedures return a value.
People develop habits depending on they learned to use programming
languages.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top