Discussion:
Write statements in function
(too old to reply)
Patrick D. Rockwell
2013-08-08 07:04:53 UTC
Permalink
Is it considered bad form to put write statements in
functions?
Bill Leary
2013-08-08 10:44:38 UTC
Permalink
Post by Patrick D. Rockwell
Is it considered bad form to put write statements
in functions?
That would depend on what they're there for.

- Bill
Patrick D. Rockwell
2013-08-09 16:39:06 UTC
Permalink
Usually, I only put them into functions during the debugging phase of their development. I guess there are a lot of other reasons to do so. :-)
Dr J R Stockton
2013-08-09 18:29:20 UTC
Permalink
In comp.lang.pascal.borland message <f756e1f1-c90f-4714-84ff-f9975c2a87f
Post by Patrick D. Rockwell
Is it considered bad form to put write statements in
functions?
Ideally, a function will have no side-effects, usually.

So it is fine to have a function whose chief purpose is to write, and it
is fine to have a function which calculates and returns an answer
without writing anything; but a mixture is often best avoided.

Similarly for procedures.
--
(c) John Stockton, nr London UK. E-addr via Homepage. Turnpike v6.05 MIME.
<http://www.merlyn.demon.co.uk/> TP/BP/Delphi/&c., FAQqy topics & links;
<http://www.merlyn.demon.co.uk/clpb-faq.txt> RAH Prins : c.l.p.b mFAQ.
Loading...