Simple clear advice in plain English

Small Basic Guide: 1. Introduction and first program

We introduce Small Basic, a great programming language for beginners

Loading the player ...
The traditional Hello World program in Small Basic

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.

Reader Comments

Small Basic Guide 3

The link for the third video does not seem to be working.

Posted by Kevin Britton, 04 Sep 2012

   

Add your comment

Please keep comments constructive and free from abuse of any kind and swearing. If you wish to link to a product or service online, please do so in such a way that makes it clear that it is not spam. If you are connected to any such product you should make that clear.

We may use your comments in the magazine. We may edit your comments for clarity or to remove unacceptable material. We will attribute your comments but not share your email address.

We request your email address and record your Internet Address (IP address) in order to block spam from our site. We will never share this information without your permission.

All comments are reviewed by the Computeractive Team before being published. Please bear with the slight delay this causes, you don't need to post more than once.

Click here to read our Privacy Policy

Click here to read our site Terms & Conditions

Related articles

small-basic-word

The Computeractive Small Basic temperature demonstration

This Small Basic program is used to convert between Celsius and Fahrenheit

small-basic-variables

Small Basic Guide: 2. Storing information in variables

We look at how to store and work with information in Small Basic

small-basic-example-program-showing-functions

Small Basic Guide: 3. Making things happen with functions

Functions are the commands in Small Basic that

Content Recommendation

Question & Answer

Q.Why is Windows Backup skipping files?

> Read the answer

Q.Why do my scanned documents display gibberish?

> Read the answer

Q.How can I convert MTS files to edit in Windows Movie...

> Read the answer

Best deals on the web

img

Apple iMac 2.7GHz 8GB 1TB 5400rpm 21.5''

£1024.95- Buy it now

img

HP Pavilion p6-2480ea (D2L08EA)

£269.95- Buy it now

img

HP Pavilion p6-2310ea (C3T79EA)

£299.99- Buy it now

Updating your subscription status Loading

Most popular articles

No matching document

Poll

Do you have Windows 8?

Jargon Buster

Computing terms explained in plain English

Bittorrent

A technology for downloading files. Allows even very large files to be downloaded quickly.

Great shopping deals from Computeractive

Information currently unavailable