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)
|