Navigation:  ThinBASIC language >

Commenting the code

Previous pageReturn to chapter overviewNext page

 

Commenting the code

 

Commenting source code is an art and a good practice for every programmer. For this reasons thinBasic has implemented many ways in which programmer can add remarks into thinBasic scripts.

 

REM keyword

 

REM keyword is the most known and classic Basic way to add comment. For example

 

REM ------------------------------------------------

REM This is the start of the main program

REM ------------------------------------------------

 

Single quotation mark (')

 

Single quotation mark (') is another classical Basic way to add remarks. Example:

 

'------------------------------------------------

' This is the start of the main program

'------------------------------------------------

 

It it a more flexible way because it allows to add remarks on a line following another statement. For example

 

DIM Msg AS STRING   '---This variable will be used ...

 

C-Like remarks

 

thinBasic allows usage of C-Like comments using /* ... */ pairs. They can be used as a block or can be used on a line following another statement. Examples:

 

/*

 ------------------------------------------------

 This is the start of the main program

 ------------------------------------------------

*/

 

DIM Msg AS STRING   /* This variable will be used ... */

 

Special single quotation mark (') remarks

 

There are special single quotation mark (') remarks followed by [] that are interpreted by thinAir (thinBasic IDE) and thinDebug (thinBasic debugger) in a special way and they can be used to classify remarks in different types.

 

For example, using special single quotation mark like the following:

 

'[] <enter your annotation here>

'[!] <pay attention note: important>

'[o] <this part needs to be optimized>

'[t] <this part needs to be tested>

'[todo] <Something to do here>

'[breakpoint] <Any note here. Breakpoint will be set to line following this statement>

 

will be interpreted and identified by the thinAir in the following way permitting a very flexible way to keep your code organized:

 

 

Finally another special single line quotation mark is the following:

 

'[book] <Bookmark text>

 

It allows to add code bookmarks for quick jump using F2 or Shift+F2 keyboard shortcuts.