TIP: Click on subject to list as thread! ANSI
echo: z3_pascal
to: All
from: Keith Bolland
date: 1996-04-24 17:31:42
subject: Functional problem

Greetings, All...

I'm sure for all you experienced programmers this is going to look ridiculous.

All the same.

Can anyone point out any flaws in this code, and how should I call it from
the main program block?

function key(validkeys, grebblevar : string) : char;
var
   happychar		: char;
   q			: integer;
   finito,invalid,valid : boolean;

begin
     repeat
	   happychar := upcase(grebblevar[1]);
	   for q := 1 to length(validkeys) do
	   begin
		repeat
		      if upcase(validkeys[q]) = happychar then
		      begin
			   key := happychar;
			   finito := true;
		      end
		      else
		      begin
			   if (q > length(validkeys)) then invalid := true;
			   if invalid = true then finito := true else finito := false; 		      end;
		until finito = true;
	   end;
	  if invalid = true then valid := false else valid := true;
     until valid;
end;

  -- Keith...
... WANTED DEAD AND ALIVE: Schroedinger's Cat.
--- timEd/2-B11
* Origin: Concilium Orb (3:771/160.41)
SEEN-BY: 633/267 270
@PATH: 771/160 772/20 712/624 517 515 711/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™.