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 beginners who wants to learn programming. The new Small Basic IDE is similarl to MS Paint, which makes programmers to work and enjoy learning. I still remember my school days when I was in my 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 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 computer for the first time or who don’t know any programming language and want to start learning programming.

Any person who want to start learning programs, the good time is to start with Small Basic instead of starting from C ,C#,VB.NET or C++. For 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 for that, since Small Basic is here for all of them.

I can strongly say that if anyone want to start learning programming 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 program within couple of days. Later, they can easily learn any language as they wish for like C++, C#, etc.

Why 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 to 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 understandable 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 from 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 Instruction 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 learn programming for the first time. When you type text in editor, you can see a small window which will display all the text starting from text (This 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 this 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 in 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 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 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 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 “.sb” extention.

extention

If we run our program we can see in the same folder with 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 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 welcome message. To perform this we need to store the name entered by user temporarily to the computer. Here we use variable 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 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 welcome message.
  2. In second line I asked the user ”What is your Name”.
  3. In 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 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 user press any key the output with user name and 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 above program the console windows were displaying the output in black and white. Now let’s add colors for background of 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 in your editor.

editor

For 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 user and add both the numbers and display the calculated result to user. Here
we use the colors to display the output as colorful.

In this program I have also commented each line of code with its use.

Comment is an important part of programming .Program is write once and used many times. If we follow to write comment on code then it will be useful for any other program who are using our program. Even for us in future it will be more useful as why we had created this line in this program.

To add comment for each line in 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 number for first and second number and then check the calculated result. Here for example I have given the first number input as 12 and 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 next article we can see in detail about some graphical window output. 

Up Next
    Ebook Download
    View all
    Learn
    View all