tags:

views:

58

answers:

2

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.

+3  A: 

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.

Greg Hewgill
+1  A: 

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 ...
Nick D