{{QBDLDATE:05-20-2022}}
{{QBDLTIME:23:11:50}}
The [[ASC]] function returns the [[ASCII]] code number of a certain [[STRING]] text character or a keyboard press.
{{PageSyntax}}
: {{Parameter|code%}} = [[ASC]]({{Parameter|text$}}[, {{Parameter|position%}}])
* {{Parameter|text$}} [[STRING|string]] character parameter must have a length of at least 1 byte or an error occurs.
* '''In QB64''' the optional byte {{Parameter|position%}} [[INTEGER]] parameter greater than 0 can specify the ASCII code of any character in a string to be returned.
* If the optional {{Parameter|position%}} parameter is omitted, ASC will return the [[ASCII]] code of the first [[STRING]] character.
* [[ASCII]] code [[INTEGER]] or [[_UNSIGNED]] [[_BYTE]] values returned range from 0 to 255.
* ASC returns 0 when reading [[ASCII]] 2 byte codes returned by [[INKEY$]] when the arrow, function, Home/Page keys are used.
** Use QB64's {{Parameter|position%}} parameter to read the second byte if necessary. {{Text|IF ASC(key$)