Introduction: BASIC Programming
Hi! I will show you today how to program in BASIC.
(BASIC=Beginner's All-Purpose Symbolic Instruction Code)
(BASIC=Beginner's All-Purpose Symbolic Instruction Code)
Step 1: How to Get BASIC-256
You can download it here:
Windows
http://downloads.sourceforge.net/kidbasic/basic256-0_9_2.zip
Sourcecode
http://downloads.sourceforge.net/kidbasic/basic256-0.9.2.tar.gz
Ubuntu Linux
Go to Applications / Add/Remove
Now make sure all applications are displayed
Search for basic-256
And install it.
(see picture)
Windows
http://downloads.sourceforge.net/kidbasic/basic256-0_9_2.zip
Sourcecode
http://downloads.sourceforge.net/kidbasic/basic256-0.9.2.tar.gz
Ubuntu Linux
Go to Applications / Add/Remove
Now make sure all applications are displayed
Search for basic-256
And install it.
(see picture)
Step 2: Text 1 - Hello, World!
Start BASIC-256 (for Ubuntu users: It's in Applications / Education.
Now enter into the programming window:
clg
cls
print "Hello, world!"
and run the program.
Output:
Hello, world!
Now enter into the programming window:
clg
cls
print "Hello, world!"
and run the program.
Output:
Hello, world!
Step 3: Text 2 - Math
The new program:
clg
cls
print "1 + 3"
print 1 + 3
print "7 - 5"
print 7 - 5
print "9 * 7"
print 9 * 7
print "5 / 4"
print 1 / 1
And the output:
1 + 3
4
7 - 5
2
9 * 7
63
5 / 4
1
Rule:
The "print" command prints a message exactly when it is enclosed in "quotation marks".
If not, you can do math with numbers and variables.
clg
cls
print "1 + 3"
print 1 + 3
print "7 - 5"
print 7 - 5
print "9 * 7"
print 9 * 7
print "5 / 4"
print 1 / 1
And the output:
1 + 3
4
7 - 5
2
9 * 7
63
5 / 4
1
Rule:
The "print" command prints a message exactly when it is enclosed in "quotation marks".
If not, you can do math with numbers and variables.
Step 4: Graphics 1 - a Circle!
Now add to the beginning of the code:
fastgraphics
and to the end:
color black
circle 145, 145, 145
refresh
so that it looks like this:
fastgraphics
clg
cls
print "Hello, world!"
color black
circle 145, 145, 145
refresh
Run it, and you see a big circle in the graphics window.
fastgraphics
and to the end:
color black
circle 145, 145, 145
refresh
so that it looks like this:
fastgraphics
clg
cls
print "Hello, world!"
color black
circle 145, 145, 145
refresh
Run it, and you see a big circle in the graphics window.
Step 5: Graphics 2 - a Rectangle!
Replace "circle 145, 145, 145" with "rect 0, 0, 290, 290"
And what do you see? A square instead of a circle!
And what do you see? A square instead of a circle!
Step 6: Graphics 3 - All Colors...
white
black
red
darkred
green
darkgreen
blue
darkblue
cyan
darkcyan
purple
darkpurple
yellow
darkyellow
orange
darkorange
gray
darkgray
clear
"clear" isn't really a color. You can erase other colors with it.
Try it out! Replace "color black" in the program with "color blue", for example.
black
red
darkred
green
darkgreen
blue
darkblue
cyan
darkcyan
purple
darkpurple
yellow
darkyellow
orange
darkorange
gray
darkgray
clear
"clear" isn't really a color. You can erase other colors with it.
Try it out! Replace "color black" in the program with "color blue", for example.
Step 7: Finish!
That's it for now. I'll make a second instructable as soon as possible.