Getting Started with MBASIC¶
Learn the basics of BASIC programming!
Note: This is a tutorial-style introduction for beginners. For detailed reference documentation, see BASIC Language Reference.
What is BASIC?¶
BASIC (Beginner's All-purpose Symbolic Instruction Code) is an easy-to-learn programming language. MBASIC 5.21 is compatible with MBASIC from the 1980s.
Your First Program¶
Every BASIC program is made of numbered lines:
- Line 10 prints text to the screen
- Line 20 ends the program
- Line numbers tell BASIC the order to run lines
How to Enter Programs¶
See your UI-specific help for how to type programs:
- Curses UI - Terminal interface
- Tkinter UI - Graphical interface
- CLI - Command-line REPL
Basic Concepts¶
Line Numbers¶
- Every line starts with a number:
10,20,30 - Numbers can be 1-65535
- Lines execute in numerical order
- Common practice: increment by 10 (leaves room to insert lines)
Printing Output¶
See: PRINT statement
Variables¶
Getting Input¶
See: INPUT statement
Program Flow¶
Loops¶
See: FOR-NEXT loops
Conditionals¶
See: IF-THEN-ELSE
Next Steps¶
- Hello World Example
- Loop Examples
- BASIC Language Reference
- Your UI's Help - Choose your interface