TIP: Click on subject to list as thread! ANSI
echo: delphi
to: MIKE JOLLS
from: JEROEN VAN ROOIJ
date: 1997-06-16 02:15:00
subject: Re: Problem with sets

Hello Mike,
Saturday, 14 June 1997 06:50:00, Mike Jolls wrote to All Subject:
Problem with sets
 MJ> I keep getting an error that Delphi is expecting an expression
 MJ> in the SET OF line. It says it's expecting a "type" but it finds
 MJ> '['. I've gone over the program and I'm typing it correctly. Can
 MJ> anybody see a problem with this?
 MJ> program Project1;
 MJ> uses Forms;
 MJ> type KeysType = set of [O..9, '*', '#' ];
 MJ> var Key : KeysType; userinput : char;
 MJ> begin Read(userinput); if userinput in Key then
 MJ> WriteLn(userinput,' is in set'); ReadLn; end.
Do it this way and it will work and it's much easyer to understand:
program Project1;
const
    Key       =  ['O'..'9', '*', '#' ];
var
    userinput : char;
begin
  Read(userinput);
  if userinput in Key then
    WriteLn(userinput,' is  in set')
  else
   WriteLn(userinput,' is not in set');
  ReadLn;
end.
 -=> Greetz, Jeroen van Rooij, <=-
.!. Forrest Gump: The pen is mightier than the sword. Yeah, right.
--- Terminate 4.00/Pro
---------------
* Origin: þThe Moutain BBSþ ++31(0)135400628, Berkel-Enschot (2:285/264.78)

SOURCE: echomail via exec-pc

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™.