What is this? About Johnny BASIC
New to BASIC? Or new to programming? Check out our Interactive Guide to BASIC
This project is still in its early stages. The BASIC development environment is not yet complete, and the Interactive Guide is also still being written. Please check back often!
The following is a scratchpad that allows BASIC commands to be executed directly.
Click or tap on the box below to enter BASIC commands:
rem this can be anything… | the whole line is a comment (i.e. ignored) | |
let name = value | assign a new value to the named variable | |
let name ( dim1, dim2, … ) = value | assign a new value to an array variable | |
dim name ( dim1, dim2, … ) | allocate a (multi)-dimensional array of variables | |
if condition then statements [ else statements ] | conditionally execute one or the other | |
for name = first to last [ step step ] | do the following statements multiple times | |
next | end of FOR loop (next iteration) | |
print value, value, … | print out (display) one or more values | |
input name, … | ask for one or more values to be entered | |
cls | clear the screen (clear previous output) | |
proc name ( value, … ) | invoke a named procedure (with arguments) | |
def proc name ( name, … ) | define a named procedure (with arguments) | |
end proc | end procedure definition | |
local name, name, … | create local variables inside a PROC | |
data value, value, … | declare literal data for READ | |
read name, name, … | read one or more data values into variables | |
restore line | set the next DATA statement to READ | |
goto line | jump to a line number (not recommended!) | |
gosub line | jump to a subroutine (not recommended!) | |
return | return from a GOSUB back to the caller |
Use a
You can omit the word LET and write bare assignments like A=2.