Table of Contents

GET

PET VIC-20 C64 C16 Plus/4 C128 X16 M65

Syntax

GET <variable>

The GET commands reads a single character from the keyboard buffer and assigns it to the given variable.

  • If the variable is a of a numeric type, it will be assigned the numeric PETSCII code of the character,
  • If the variable is a STRING, it will be assigned the character itself, as string.

Warning

The variable must be pre-defined.

Example

Waiting for a key in the buffer:

DIM a$ AS STRING * 1
DO
  GET a$
LOOP UNTIL LEN(a$) > 0
PRINT "you pressed: "; a$

Or a simpler equivalent:

DIM a AS BYTE
DO
  GET a
LOOP UNTIL a > 0
PRINT "you pressed: "; CHR$(a)