Q1: What does this mean: WriteLn (#$0b)
?
$0b
should hexadecimal like 0x0b
, but what about the #
sign?
Q2:
x:=readkey;
if ( x = #5) do...
Does #5
mean five? Then what is the#
sign for?
Many thanks.
Q1: What does this mean: WriteLn (#$0b)
?
$0b
should hexadecimal like 0x0b
, but what about the #
sign?
Q2:
x:=readkey;
if ( x = #5) do...
Does #5
mean five? Then what is the#
sign for?
Many thanks.
The #
in front of a number represents a character with the indicated value (both decimal, and hex numbers preceded by a $
, are accepted). So #5
is the same as chr(5)
, or CtrlE.
Ah, memories ...
#x
is indeed the equivalent of chr(x)
, like Greg Hewgill said.
I'd like to add a little info.
Extended keys, ie the arrow keys, send zero and the char's code:
ch := ReadKey;
if ch = #0 then
begin // extended key
ch := ReadKey; // <-- read again to get the actual code
end else ...