This shows you the differences between two versions of the page.
pt:key [2016/01/01 22:48] |
pt:key [2020/02/28 10:46] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ===== Key ===== | ||
+ | ==== Formato ==== | ||
+ | key\\ | ||
+ | key() | ||
+ | ==== Descrição==== | ||
+ | Devolve o valor ASCII do caracter correspondente à tecla premida. Caso nenhuma tecla seja premida devolve 0. | ||
+ | |||
+ | ==== Nota ==== | ||
+ | < | ||
+ | if key = 47 then print key | ||
+ | </ | ||
+ | não produz os resulatados pois acede à tecla duas vezes em sucessão, e devolve valores diferentes de cada vez. Este código produzirá os resultados desejados: | ||
+ | < | ||
+ | a = key | ||
+ | if a = 47 then print a | ||
+ | </ | ||
+ | |||
+ | ==== Exemplo==== | ||
+ | < | ||
+ | #prima qualquer tecla | ||
+ | loop: | ||
+ | pause 1 | ||
+ | a = key | ||
+ | print a+" | ||
+ | goto loop | ||
+ | </ |