{{fbdoc item="title" value="GETKEY"}}----
Returns the ascii code of the first key in the keyboard buffer

{{fbdoc item="syntax"}}##
	[[KeyPgDeclare declare]] [[KeyPgFunction function]] **Getkey** ( ) [[KeyPgAs as]] [[KeyPgLong long]]
##
{{fbdoc item="usage"}}##
	//result// = **Getkey**
##
{{fbdoc item="ret"}}
	The value of the ascii code returned.

{{fbdoc item="desc"}}
	It returns the ascii code of the first key in the keyboard buffer. The key is removed from the buffer. If no key is present, ##**Getkey**## waits for it. For extended keys (returning two characters), the extended code is returned in the first byte, and the regular code is returned in the second byte. (see example below)

	The key read is not echoed to the screen.

	For a keyword not stopping the program if no key is at the buffer see ##[[KeyPgInkey Inkey]]## or ##[[KeyPgMultikey Multikey]]##.

{{fbdoc item="ex"}}
{{fbdoc item="filename" value="examples/manual/input/getkey.bas"}}%%(freebasic)
dim as integer foo
do
	foo = getkey
	print "total return: " & foo
	
	if( foo > 255 ) then
		print "extended code: " & (foo and &hff)
		print "regular code: " & (foo shr 8)
	else
		print "regular code: " & (foo)
	end if
	print 
loop until foo = 27
%%


{{fbdoc item="lang"}}
	- Not available in the //[[CompilerOptlang -lang qb]]// dialect unless referenced with the alias ##**""__Getkey""**##.

{{fbdoc item="diff"}}
	- New to ""FreeBASIC""

{{fbdoc item="see"}}
	- ##[[KeyPgGetmouse GetMouse]]##
	- ##[[KeyPgInkey Inkey]]##
	- ##[[KeyPgInputnum Input()]]##
	- ##[[KeyPgMultikey Multikey]]##

{{fbdoc item="back" value="CatPgInput|User Input"}}