← All lessons

LESSON 2 OF 13

VARIABLES AND INPUT

Remembering things and asking the user questions.

INPUTvariablesstringsnumbers

A variable is a named box that holds a value. A$ (with a dollar sign) holds text — a string. A plain name like A holds a number. Only the first two characters of a name matter, so SCORE and SCREEN are the same variable. Yes, really.

INPUT prints a question mark, waits for you to type something and press RETURN, then stores it. INPUT "WHAT IS YOUR NAME";N$ prints the prompt first.

Inside PRINT you can mix text and variables. A semicolon joins things together with no gap; numbers always print with a space in front.

LESSON 26 lines

Type with the keyboard under the screen, or tap the blue screen to use your phone's own keyboard. While a program runs, keys go to INPUT and GET. When it says READY., type a line and press RETURN to run it straight away.