We introduce Small Basic, a great programming language for beginners
Programming isn't just for professional programmers writing large and commercial programs. A basic knowledge of how programs work can be very helpful if you ever want to tweak a macro in Word or help solve some maths homework.
We are going to introduce a programming with a language called Small Basic. It's great for beginners because the code editor offers help as you type commands.
Read more: Programming articles | Small Basic articles
It also has a tool for importing programs from the Small Basic website. This gives you access to a wide range of examples to see what is possible and how it's done. For example click on the Import button, type tetris and press enter to load a Tetris clone from the Small Basic website.
Small Basic can be downloaded from our website here. You will need the Microsoft .NET Framework 3.5 installed on your computer for Small Basic to work. This can be downloaded from the Microsoft site here.
There is a tradition in programming that the first program a new programmer writes simply says "Hello World".
Start Small Basic. There is a toolbar at the top and an area for writing the code, which is white and says Untitled in the title bar. There is a blue column on the right hand side of the window. This displays help about commands as you write them.
Left-click inside the white text area. There is a small 1 in the grey margin. Like other programming languages, Small Basic numbers the lines in a program as this makes it easier to track down problems. Type the following command
TextWindow.WriteLine("Hello World!")
Click on the Run button or press F5 to run the program. Another window will appear that will say "Hello World! Press any key to continue". Press any key to close the program and return to Small Basic.
Congratulations you've just written your first program. You can either skip on to our next video or hang around while I explain some of the helpful tools in Small Basic
It will quickly become clear that Small Basic is eager to help. Firstly it suggests commands as you type in a list that appears underneath the cursor. Use the up and down arrow keys to move through the options and press enter to complete the command.
Secondly it colours text to show what Small Basic thinks the text is. This is very useful when tracking down problems. For example, let's deliberately add another line to the program that includes an error to show how Small Basic will help fix it. Enter the following code on line two
TextWindow"Writeline("Hello World!")
First you can see that the colours look wrong compared to the line above and this is the first pointer that all is not well. Click on the Blue Run arrow and instead of the text window of the preview example, an error message will appear at the bottom of the text entry window. In this case it says "Sorry, we found some errors... 2,11: Unrecognised statement encountered."
The first number is the line with the error and then second is the position in the line where the problem occurred. Hopefully, you've noticed that this is because there is a " where there should be a full stop. Correct this and see how the colour changes and then click on the Blue Run button to check that it is working.
As easy as Small Basic is to learn, there are times when it is helpful to leave notes in code in plain English. Small Basic ignores any lines that start with an ‘ when it comes to running your program and it formats this green and in italics.
Article tags
Related articles
Content Recommendation
Q.Why is Windows Backup skipping files?
Q.Why do my scanned documents display gibberish?
Q.How can I convert MTS files to edit in Windows Movie...
Updating your subscription status
A technology for downloading files. Allows even very large files to be downloaded quickly.
Small Basic Guide 3
The link for the third video does not seem to be working.
Posted by Kevin Britton, 04 Sep 2012