We put all of the lessons from the previous lessons together into a full program
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
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.
Updating your subscription status