| 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. Regardless of the
PL> value, the name of the function is actually what is
PL> returned when called.. other than that it's like writing a
PL> procedure that only returns one value. Therefore a
PL> function will not have a var in it's header.. :)
Ain't necessarily so - a function may return var parameters just like any
other procedure, as well as its function result:
program off_the_top_of_my_head;
function is_a_letter (var c : char; var is_a_comma : boolean) : boolean;
begin
is_a_letter := true;
is_a_comma := (c = ',');
if not (c in ['A'..'Z']) then
if c in ['a'..'z'] then c := upcase (c)
else is_a_letter := false
end;
var ch : char; comma : boolean;
begin
read (ch);
if is_a_letter (ch, comma) then
writeln (' is a capital letter')
else begin
write (' isn''t a letter at all');
if comma then write (' .. but IS a comma');
writeln
end
end.
E&OE, Ian
--- MaltEd 1.0.b5
* Origin: Magic Puddin' BBS Nimbin 066-89-1843 V.32bis/V.42 (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™.