| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Functional problem |
PL>> A function is used to return one value.
IS> Ain't necessarily so - a function may return var parameters just like
IS> any other procedure, as well as its function result:
PL> Ok.. I see.
PL> I was just repeating how I have been taught to use
PL> functions at TAFE.. it's the schools' approved usage of
PL> functions. :)
Beware of fashions :)
See if the TAFE library has a copy of Kernighan and Plauger's 'Software
Tools in Pascal', for extensive examples of Really Good Code, many of which
return function results in Var parameters, meanwhile often returning the
function's result as a boolean or 'errorlevel' indicator. A wee example,
from 'find' ..
[..]
begin
if (not getarg (1, arg, MAXSTR)) then
error ('usage: find pattern');
if (not getpat (arg, pat)) then
error ('find: illegal pattern');
while (getline (lin, STDIN, MAXSTR)) do
if match (lin, pat) then
putstr (lin, STDOUT)
end;
Re SWAG, I think others have covered that pretty well, and I'm way behind
with my versions here.
Cheers, Ian
--- MaltEd 1.0.b5
* Origin: Puddin' (3:626/660)SEEN-BY: 633/267 270 @PATH: 626/660 711/401 808 50/99 635/544 727 633/267 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.