ch :=onekey('0123456789Q',true);
if ch = 'Q' then
begin
exit
end else
instr := str2int(ch);
if instr = 0 or instr = 1 or instr = 2 or instr = 3 or instr = 4
or instr = 5 or instr = 6 or instr =7 or instr = 8 or instr = 9 then
fn := instr;
Since you are using OneKey, you know that if its not a Q then its a valid number, so you dont need that big IF statement.
Var
Ch : Char;
InStr : Byte;
Begin
Ch := OneKey('0123456789Q', True);
If Ch = 'Q' Then Exit;
// Since we know Q has exited, then the only possible result left is 0-9
// so no need for an IF statement.
InStr := Str2Int(Ch);
WriteLn ('Value of InStr is ' + Int2Str(InStr));
End;
--- Mystic BBS v1.12 A35 (Windows/32)
* Origin: Sector 7 [Mystic BBS WHQ] (21:1/108)