Small Basic Featured Article – Grammar Basics

LitDev and Nonki have been helping us build a strong library of Small Basic content on TechNet Wiki.

Please check out this article from :

Small Basic: Grammar Basics


This article describes the main language elements or 'grammar' used by the Small Basic language and gives some suggestions for further study.  There are several 'getting started' guides, this is just another with a slightly different emphasis.

The Small Basic language has some main grammar features that this article focuses on:

  1. Keywords - these control the logic of the program such as loop (repeat something For or While) or conditional (branch where the program goes depending on the value of a variable - If), define a subroutine (Sub) etc - they are colored blue in Small Basic.
  2. Variables (black) - these are names given to things we use and store and do things with - think of them like draws that we can put things in and store these things while we do stuff with them.
  3. Literals (orange) - Values that are not stored in variables, like a number 3.14 or set of characters in quotes "Hi There!".
  4. Objects (gray) - these are special functions that have been provided to do certain things, like add a picture to a display.  There are several of them in Small Basic, like TextWindow, Clock etc.
  5. Methods, Parameters and Events (dark red) - these are found for the different objects by typing a dot after the object.  They do the special things - they may also need some data to work with (called parameters) or return some data.
  6. Comments (green) - anything after a ' (single quote) is not read by the compiler it is just comments for you to remember what you did or why - make good use of these.


The first program we usually write in any language is the 'Hello World' program that writes this out.

In Small Basic, this is:

TextWindow.WriteLine("Hello World")

TextWindow is an Object
WriteLine is a Method, the brackets show that this method needs some data to work with - in this case, what to write.
"Hello World" is what we want the write and it is put in double quotes - and is called a literal since it is not a variable, but is just a value (not in a draw).

For more info, see the Statements sections in the article...



Once again, thanks to for this great article!

   - Ninja Ed



Comments (1)

  1. Speaking of LitDev, here's his first blog post on this blog:…/smallbasic-types.aspx

Skip to main content