Words that are deemed to be reserved are the commands of the language. You will not be able to name your variables, arrays or user functions if they exist as part of the language as commands. As you become more familiar with the language, you will be able to naturally avoid using reserved words for your variables, array names and user functions.
You are able to write statements in your program that will be completely ignored when run. This may seem strange at first, but actually provides one of the most important features of your programming armoury. Remarks, also known as code commentary or documentation, are the plain English descriptions of what your program does at any point in the code.
Although BASIC is quite concise as a readable language, it"s never entirely clear what a piece of code is supposed to do if you read it for the first time. Do not be fooled into thinking the code you write yourself is for your eyes only. Returning to a piece of code you wrote 3 months previous will dispel any concerns you may have over the importance of remarks.
The trick is to write only a summary of what a piece of code does. Leave out details, data and snippets that may change or be removed. Avoid typing a half-page description as the likelihood is that you"ll never find the time to read it. Remarks become a highly powerful part of your program if used correctly.
You can use the REM command to make a comment, as follows:
REM Print a greeting for the user PRINT ( "Hello World" )
There are other ways to make remarks in a program, such as the single open quote symbol:
` Print a greeting for the user PRINT ( "Hello World" )
Or the more common double forward slash used in other languages:
// Print a greeting for the user PRINT ( "Hello World" )
If you wish to "comment out" a number of lines in your program, you can avoid adding a REM command at the start of each line by using the following:
REMSTART PRINT ( "Hello World" ) PRINT ( "Hello World" ) PRINT ( "Hello World" ) REMEND
Anything between the REMSTART command and the REMEND command will be ignored when the program is run. These commands are especially useful for temporarily removing parts of the program for testing purposes.
You can also use the symbols /* and */ to comment multiple lines. This is an alternative to REMSTART and REMEND and will be more familiar to users of other languages, for example:
/* PRINT ( "Hello World" ) PRINT ( "Hello World" ) PRINT ( "Hello World" ) */
Unlike other BASIC languages, spaces are very important in your programs. It is important to separate commands and parameters, otherwise your program will not be understood. Take for example the line:
FOR T=1 TO 10
This would not be recognized if written as:
FORT=1TO10
Nor would this be easy to read either. Providing you use spaces to separate commands and parameters, you will encounter no problems with spacing.
You can also use it where it might make code easier to understand, even if the spaces are not necessary. For example both of the following are valid, and do exactly the same thing, but the latter might be easier to understand for someone else looking at your code
b=4-6*c a=2*(b+1)+c/4
b = 4 - 6*c a = 2*(b+1) + c/4