Small Basic > Getting Started Guide > Chapter 1: An Introduction


Small Basic and Programming

Computer Programming is defined as the process of creating computer software using programming languages. Just like we speak and understand English or Spanish or French, computers can understand programs written in certain languages. These are called programming languages. In the beginning there were just a few programming languages and they were really easy to learn and comprehend. But as computers and software became more and more sophisticated, programming languages evolved fast, gathering more complex concepts along the way. As a result most modern programming languages and their concepts are pretty challenging to grasp by a beginner. This fact has started discouraging people from learning or attempting computer programming.

Small Basic is a programming language that is designed to make programming extremely easy, approachable and fun for beginners. Small Basic’s intention is to bring down the barrier and serve as a stepping stone to the amazing world of computer programming.

The Small Basic Environment

Let us start with a quick introduction to the Small Basic Environment. When you first launch SmallBasic, you will see a window that looks like the following figure.

Figure 1.1 - The Small Basic Environment

Figure 1.1 - The Small Basic Environment

This is the Small Basic Environment, where we’ll write and run our Small Basic programs. This environment has several distinct elements which are identified by numbers.

The Editor, identified by [1] is where we will write our Small Basic programs. When you open a sample program or a previously saved program, it will show up on this editor. You can then modify it and save if for later use.

You can also open and work with more than one program at one time. Each program you are working with will be displayed in a separate editor. The editor that contains the program you are currently working with is called the active editor.

The Toolbar, identified by [2] is used to issue commands either to the active editor or the environment. We’ll learn about the various commands in the toolbar as we go.

The Surface, identified by [3] is the place where all the editor windows go.

Our First Program

Now that you are familiar with the Small Basic Environment, we will go ahead and start programming in it. Like we just noted above, the editor is the place where we write our programs. So let’s go ahead and type the following line in the editor.

TextWindow.WriteLine("Hello World")

This is our first Small Basic program. And if you have typed it correctly, you should see something similar to the figure below.

Figure 1.2 - First Program

Figure 1.2 - First Program

Now that we have typed our new program, let’s go ahead and run it to see what happens. We can run our program either by clicking on the Run button on the toolbar or by using the shortcut key, F5 on the keyboard. If everything goes well, our program should run with the result as shown below.

Figure 1.3 - First Program Output

Figure 1.3 - First Program Output

Congratulations! You have just written and run the first Small Basic program. A very small and simple program, but nevertheless a big step towards becoming a real computer programmer! Now, there’s just one more detail to cover before we go on to create bigger programs. We have to understand what just happened – what exactly did we tell the computer and how did the computer know what to do? In the next chapter, we’ll analyze the program we just wrote, so we can gain that understanding.

Note: As you typed your first program, you might have noticed that a popup appeared with a list of items (Figure 1.4). This is called “intellisense” and it helps you type your program faster. You can traverse that list by pressing the Up/Down arrow keys, and when you find something you want, you can hit the Enter key to insert the selected item in your program.

Figure 1.4 - Intellisense

Figure 1.4 - Intellisense

Saving our program

If you want to close Small Basic and come back later to work on the program you just typed, you can save the program. It is in fact a good practice to save programs from time to time, so that you don’t lose information in the event of an accidental shutdown or a power failure. You can save the current program by either clicking on the “save” icon on the toolbar or by using the shortcut “Ctrl+S” (press the S key while holding down the Ctrl key).

Next Chapter


See Also