Re: Proper way to return a string
- From: Ron Shepard <ron-shepard@xxxxxxxxxxxxxxxxxx>
- Date: Wed, 27 Dec 2006 13:45:43 -0600
In article <slrnep5g8k.3020.Jeremy@xxxxxxxxxxxxxxxxxxx>,
Jeremy <my-first-name@xxxxxxxxxx> wrote:
I guess I am still trying to understand when I should use a function
and when I should use a subroutine with inout/out parameters.
You may get lots of opinions, but here is how I make my choices.
Basically, if you expect that expressions like
a = fun(arg) + fun(arg)
are useful, and if the functions don't have side effects or perform
i/o operations that make this illegal, then functions might be the
best choice. But if you always expect only a single function call
per statement, if the function has side effects (including changing
the value of its argument), or if the function does i/o (which is
problematic in some contexts), then you are probably better off with
a subroutine. If there is any doubt about any of these things
(including future use of the subprogram by you or other
programmers), then you should probably use a subroutine.
$.02 -Ron Shepard
.
- References:
- Proper way to return a string
- From: Jeremy
- Proper way to return a string
- Prev by Date: Re: Proper way to return a string
- Next by Date: Re: Proper way to return a string
- Previous by thread: Re: Proper way to return a string
- Next by thread: Okular-Infos
- Index(es):