RETURN (Key)

From C64-Wiki
Jump to: navigation, search
Disambiguation The title of this article is ambiguous. RETURN (Disambiguation).


With the key <RETURN> or RETURN  are finished data inputs by the homecomputers like the C64/128 or VIC-20. After using the key RETURN  BASIC commands will be executed, data inputs (through the INPUT command) will be processed and entered command lines will be saved into the BASIC-RAM. Also the key RETURN  is called enter key.


Programming[edit]

The controlling of the key RETURN  in programs isn't easy, because the function of the key RETURN  is always there! The following methods show ways for controlling the key RETURN :

With the BASIC command GET[edit]

By using the ASCII code 13 for <RETURN> with CHR$(13):

10 PRINT "Please, push any..."
20 PRINT "...key";
30 GET A$ : IF A$="" THEN 30
40 IF A$ = CHR$(13) THEN PRINT ":<RETURN> - The program ends here !" : END
50 PRINT ":"A$ : GOTO 20

The program ends with pushing the key RETURN . Each key (without the key RUN/STOP ) can be pushed.

With the BASIC command PEEK[edit]

10 REM *** Break with RUN/STOP ***
11 PRINT : PRINT "Please, push any key..."
12 T = PEEK(197): IF T = 64 THEN 12
13 PRINT "You push the key code: "; T 
14 IF T = 1 THEN PRINT "!!! This was the key <RETURN> !!!"
15 GOTO 11