Getting Started With Microsoft Small Basic For Beginners

Microsoft always makes the programming environment better and easy. Now, there is a new addition for programming learners that is called Small Basic. Small Basic is for any beginner who wants to learn to program. The new Small Basic IDE is similar to MS Paint, which makes programmers work and enjoys learning. I still remember my school days when I was in high school. During our computer class, the teacher used to ask to start with MS Paint. By using MS paint, we started learning how to use a mouse, etc. Now, I can say instead of teaching MS Paint to any new user we can ask them to Start with Small Basic, Yes, Small Basic will be easy for any new person who is working on the computer for the first time or who don’t know any programming language and want to start learning to program.
 
For any person who wants to start learning programs, the good time is to start with Small Basic instead of starting from C, C#, VB.NET, or C++. Many people who start learning any language like C, C++, C# and etc, found it hard to understand all the basics. Without understanding the basics it will be hard for them to write a good program. Now no need to worry about that, since Small Basic is here for all of them.
 
I can strongly say that if anyone wants to start learning to program for the first time they should start with Small Basic. They will surely easily understand what is IDE and Editor and how to run a program, how to write their own logic of the program within a couple of days. Later, they can easily learn any language they wish for like C++, C#, etc.
 
Why do I recommend Small Basic for Beginners who want to learn Programming?
  • Simple and Easy
  • Small Basic IDE is similar to MS Paint which makes beginners learn with fun.
  • Even Middle School Students can understand easily.
How to install Small Basic
 
You can download the Small Basic from the following link:
Here is a TechNet Wiki Article which has all the links to start learning Small Basic.
Installation Steps
 
After downloading Small basic from the above link install it on your computer.
 
setup
 
Click Next and Install Microsoft Small Basic.
 
setup
 
Finally, click on Install Button which will install the Small Basic on your computer.
 
After installation, you can find the Small Basic Icon,
 
small basic
 
Click and open Microsoft Small Basic.
 
When we open Small Basic for the first time we can see the Development Environment with the following 3 parts:
  1. Tool Bar: Simple and easy to understand by any user as this has only New, Open, Save, Save As, Cut, Copy, Paste, and Run.
  2. Editor: Here we write our Programs (This looks similar to Notepad).
  3. Help Window: Which will display our programming commands.
small basic
 
Our First Small Basic Program (For Output)
 
Let’s create a simple program to display our Name as output. It will be always fun to see our name to be displayed in our first program. I still remember my high school days as I was so happy to see my name to be displayed from C Language using printf().
 
Now let’s see how to write our first program to display our Name from Small Basic.
 
The Output is to display any text or value from our program. As we all know, Program is nothing but a set of instructions. Using one of the Instructions we can display our output.
 
To display the Output from Small Basic we will be using the following,
 
TextWindow.WriteLine(“your output text”);
 
As I have told Small Basic Development Environment is much easier for any new developer who learns to program for the first time. When you type text in the editor, you can see a small window that will display all the text starting from the text (These are all the instructions to perform our programming result).
 
result
 
Here, we are using TextWindow.WriteLine(); to display out first output. To display the output we use the WritLine() and to read the Input from the user we will use the Read(). Here WriteLine() and Read() are called as a function, which means these two Read() and WritelLine() will have some set of Instruction which will execute our text and display or get the text from users.
 
writeline
 
Now let’s display our Name.
 
TextWindow.WriteLine("My Name is SHANU.Welcome to My first Program").
 
You can copy this code and paste it into your Small Basic Editor. Note “SHANU” is my name, so you have to change it to your name.
 
Yes, now we have written our first program to display our name so what is next. Now we need to run the program and view our Output.
 
To run the program we can press F5 from the keyboard or we can click on the Run from the Tool Window.
 
output
 
So here is our first program output. I can feel how much you are happy while seeing your successful message. To close the output window you can press any key. Here all the output is based on Console so in the next tutorial we will see about graphical window output.
 
Save the Program
 
You have successfully created your first program. Now you need to save the program so that you can use it later and also you can modify the same program with more functionality. To save the program from Toolbar you can see the Save Icon click on that and save the program to your selected folder for easy access.
 
save the program
 
The program will be saved as a “.sb” extension.
 
extention
 
If we run our program we can see it in the same folder with a few more files like “.dll” and “.exe” extension files. We can also run directly by clicking the “.exe” file. Here “.exe” is an executable file.
 
output
 
Open the Saved Program
 
To open the existing saved file we can click on the Open icon from the toolbar in Small Basic. Go to the path where you have saved your program. Select the “.sb” extension file and click open.
 
open
 
Our First Small Basic Program (For Input/output using Variable)
 
So you have successfully created your simple program to display your name as output. Now let’s see how to give input to your program and display the output of your input.
 
So what is the use of getting Input? Now, for example, you want to write a program where others can give their name as input and you need to display the user entered Name with a welcome message. To perform this we need to store the name entered by the user temporarily on the computer. Here we use variables to store the input. The variables will reside in computer memory temporarily till we close our program.
 
In this example program let us see how to store our name to a variable and display the output from our program.
  1. TextWindow.WriteLine("My Name is SHANU.Welcome to My first Program")  
  2. TextWindow.WriteLine("What is your Name")  
  3. myname=TextWindow.Read()  
  4. TextWindow.WriteLine("welcome " + myname)  
Copy the above code and paste in your editor.
 
editor
 
 
  1. Here we can see first I displayed my name with a welcome message.
  2. In the second line, I asked the user ”What is your Name”.
  3. In the third line, we can see I have used the variable “myname” and storing the user input to this variable.
  4. To get the user input here we use TextWindow.Read() (For output we use WriteLine() and to get the input here we use Read()).
  5. Here we print the result with a welcome message.
When we run the program first it will look like the following, 
 
output
 
Here we can see first it displayed our name and then ask to give the input as “What is your Name”. Now user can give the input in the empty line. Here I have given the name of my son as “Afraz”.
 
output
 
After entering the name when the user press any key the output with a user name and a welcome message will get displayed.
 
output
 
Now we have successfully created our program to read input and print the output.
 
Simple Program to display Background and font with colors
 
So far in the above program, the console windows were displaying the output in black and white. Now let’s add colors for the background of the text and give some colors for the font.
  1. TextWindow.BackgroundColor="yellow"  
  2. TextWindow.ForegroundColor="blue"  
  3. TextWindow.WriteLine("wow now it looks cool with colors")  
Copy the above code and paste it into your editor.
 
editor
 
For the background color, we use the following,
  1. TextWindow.BackgroundColor="yellow"  
We can give any Small Basic supported color as we like.
 
For Font color, we use the following,
  1. TextWindow.ForegroundColor="blue"  
We can give any Small Basic supported color as we like.
 
Now we give some text output and press F5 or click on the Run button from the Toolbar. We can see the final output with cool color as output in our console window.
 
console
 
Program to Add 2 Numbers
 
Now let’s create a simple program to get two numbers as input from the user and add both the numbers and display the calculated result to the user. Here we use the colors to display the output as colorful.
 
In this program, I have also commented on each line of code with its use.
 
Comment is an important part of programming. Program is written once and used many times. If we follow to write a comment on code then it will be useful for any other program who are using our program. Even for us in the future, it will be more useful as to why we had created this line in this program.
 
To add comments for each line in the program we use single quotes '. Note we add the Single quotes ' then the text inside the quotes will be in green color to differentiate as this is a comment.
 
This program needs any explanation as I have commented in each line with its uses. I have used all our above 3 programs and made one program as this has output, input, and colors.
  1. TextWindow.BackgroundColor="yellow" ' Background Color as Yellow  
  2. TextWindow.ForegroundColor="darkgreen" 'Font Color as Yellow  
  3. TextWindow.WriteLine("Welcome to simple Addition program") 'Welcome Msg  
  4. TextWindow.WriteLine("Enter your First Number") 'Ask user to enter first number  
  5. TextWindow.BackgroundColor="cyan" 'Back color for first input  
  6. TextWindow.ForegroundColor="blue" 'Font color for first input  
  7. number1=TextWindow.Read() ' read the user input and store in number1 variable  
  8. TextWindow.BackgroundColor="yellow" 'Back color   
  9. TextWindow.ForegroundColor="darkgreen" 'Font color  
  10. TextWindow.WriteLine("Enter your Second Number") 'Ask user to enter Second number  
  11. TextWindow.BackgroundColor="cyan" 'Back color   
  12. TextWindow.ForegroundColor="blue" 'Font color  
  13. number2=TextWindow.Read() ' read the user input and store in number2 variable  
  14. Calculation=number1+number2 'Add both number1 and number2 store the result in Calculation  
  15. TextWindow.BackgroundColor="yellow" 'Back color   
  16. TextWindow.ForegroundColor="red" 'Back color   
  17. TextWindow.WriteLine("The result is " + Calculation) ' Display the final result  
Copy the above code and paste in your editor,
 
editor
 
Run the program
 
Give your input as numbers for the first and second numbers and then check the calculated result. Here for example I have given the first number input as 12 and the second number input as 8 and so the calculated result you can see in the output.
 
final output
 
Hope this article is helpful for beginners. In the next article, we can see in detail some graphical window output.