Simple clear advice in plain English

Small Basic Guide: 5. Making a complete program

We put all of the lessons from the previous lessons together into a full program

Loading the player ...
The Computeractive temperature conversion program written in Small Basic

Now that we have covered the basics of programming with Small Basic, Let's take a look at a program that does something meaningful. Click on the Import button and type mbt226

Read more: Programming articles | Small Basic articles

This program will convert temperature between Celsius and Fahrenheit and then, just for fun, colour the result depending on how hot it is.

Lines 1 to 4 print the required messages that explain what the program does and asks which direction to make the temperature conversion. Line 5 waits for an answer and then puts it in the answer variable. Lines 6 and 7 then ask for the current temperature and put it in the startingTemp variable.

There are then three IF commands. The first decides which temperature conversion to use and then there is another IF command for each conversion to colour the text. Putting IF and FOR commands within another command is known as nesting and can be very powerful, reducing repetitive calculations to just a few lines, which are easier to read. You can experiment with how these commands work in the following ways.

Saving and loading
Small Basic has its own file format for programs. Click on the Save icon in the Ribbon at the top and select a name and location for your work. It is a good idea to create a new folder just for the programs. Small Basic has one more clever trick up its sleeve. It can load programs directly from the internet. All it needs is a code for the program shown on the Small Basic website.

Further programming – Visual Basic, Express Editions and Python
Once you've got to grips with Small Basic you may well find that it becomes limiting; it is designed to be an introduction to programming rather than a complete tool. There are several paths to take if you want to go further.

Microsoft Office has its own programming language called Visual Basic for Applications. This can be used to create your own functions in Excel or to edit macros. There's an example of a simple Excel Function that saved a lot of time on our blog here.

Alternatively Microsoft produces a range of programming tools called the Express Editions. Click here to download Microsoft Visual Studio Expres Edition 2012. These are powerful tools that are available at no cost. Visual Basic is the closest to Small Basic and Small Basic can convert programs into Visual Basic if you have Visual Basic Express Edition installed.

If you want to take a different route and go with more open tools, Python is an independent programming language. It can be used to make useful programs but the code editors don't always offer as much help as those from Microsoft. Find out more on the beginners guide here.

Reader Comments

   

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-hello-world

Small Basic Guide: 1. Introduction and first program

We introduce Small Basic, a great programming language for beginners

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

Samsung NP350E7C-A04UK

£349.99- Buy it now

img

Toshiba Satellite C850D-11Q (PSCC2E-00R00JEN)

£299.97- Buy it now

img

Lenovo G580 (MAANJUK)

£379.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

VoIP

Voice over IP. The routing of voice conversations over the internet, which is cheaper than the telephone...

Great shopping deals from Computeractive

Information currently unavailable