

Determine if a key has been pressed and store this in a variable.

If no key has been pressed, the program should continue without waiting.




import os, illwill
 
illwillInit(fullscreen=false)
 
while true:
  var key = getKey()
  case key
  of Key.None:
    echo "not received a key, I can do other stuff here"
  of Key.Escape, Key.Q:
    break
  else:
    echo "Key pressed: ", $key
 
  sleep(1000)
 