====== INKEY$ ====== /* Remove the comments after creating content for each section.*/ Returns the character (or scan code, for control/special keys) //immediatelly// available in the keyboard buffer, without blocking /* For the lines below, just create links, separated by commas, to other pages of the BASICs section, like [[:basics:basicTagName]]. "Implemented by" should mention BASICs which implement the keyword like described, in a more usual and standard way. "With variations" should point to BASICs where this keyword is used a bit differently. "Also written as" should list alternative spellings and abbreviations this keyword has. No need to refer to a BASIC, there is a section for that later. */ **Implemented by:** [[:basics:msatari:]], [[:basics:trs80:level2]], [[:basics:trscolor:]], [[:basics:trscolor:colormc]], [[:basics:Sinclair:zx81]], [[:basics:Sinclair:spectrum]], [[:basics:BBC:]], [[:basics:GWBASIC:]], [[:basics:MSX:]], [[:basics:bwbasic:]], [[:basics:bwbasic:bw32]], [[:basics:msqb:QBasic]], [[:basics:VBDOS:]], [[:basics:minibasicjs:]] **With variations:** **Also written as: ** ===== Usage ===== /* For inline examples of syntax, write the keyword between '' and '' (two single quotes) */ INKEY$ will **not** stop and wait for the user to type something. If there is //not// a pressed key or a character in the keyboard buffer, it just returns nothing and goes away. Because of that, the most common way to use it was something like: 240 K$=INKEY$:IF K$ = "" THEN 240 It was no big deal in the 8-bit era when the BASIC program was the only thing running at the machine, but in more modern multitasking systems this will often sky-rocket CPU usage and make everything slow. It is necessary to give up some time for the system during the loop — some milliseconds per iteration is enough. ==== Variations ==== ===== Examples ===== /* Below is an example of a code block, using GeSHi syntax highlighting for //gwbasic//. Other styles of interest might be //basic4gl//, //blitzbasic//, //freebasic//, //gambas//, //locobasic//, //purebasic//, //qbasic//, //sdlbasic//, //thinbasic//, //vb//, //vbnet//, //xbasic// or //zxbasic//. 10 PRINT "HELLO" */ ===== Comments ===== /* Origin of the keyword, opinions, history... */ ===== Related keywords ===== /* Keywords that are often or always used along this one */ * [[GET]] ===== Similar keywords ===== /* Keywords with the same or similar functionality found in other versions of BASIC */ ===== In other languages... ===== /* For parallels and comparisons with other modern-day languages */ In many modern languages, it is surprisingly difficult to have something like INKEY$ for input in a text-mode application. In C, the hairy //ncurses// library is probably the most used option. ===== References ===== /* If you used the ((citation)) syntax elsewhere in the text, they will appear under this section. But you can write some recommendations of books, magazines, etc */ /* ===== TAGS ===== Please use the syntax below for adding tags to this page, separated by spaces (use quotes for tags with spaces). The most important tags to be used are, separated by groups: - Statements | Commands | SpecialVariables | Operators {{tag>tagName}} */ {{tag>Function Events Console}}