RTB is an interpreter which means that it’s slower than traditionally compiled languages such as C/C++. However it tokenizes your program into a compact intermediate state which is much quicker to interpret at run time.
Traditionally BASIC uses line numbers – you enter a program one line at a time and give each line its own number. The numbers can be used as the target of GOTO and GOSUB statements.
No line numbers
Using the built-in screen editor, you can write programs that don’t use line numbers – this is more in thinking with modern programming techniques where the use of GOTO is often frownwd upon. Rather than use GOTO (and GOSUB), there are modern methods for calling named procedures and modern looping constructs too.
Data types and variables
RTB Supports two data types: Floating point (or real) numbers using IEEE 754 double precision (64-bit format), and character strings. Strings may be any length up to the limit of available RAM.
Arrays of numbers and strings are permitted and arrays can have any number of dimensions and indices – again limited by the available RAM.
Array indices can be numeric, or string based (to create a form of associative array)
Variable names can be any length up to the limit of the maximum line length allowed (currently 1024 characters).
In addition to the traditional BASIC GOTO statement (when you use line numbers), RTB supports a single-line IF…THEN construct and a multi-line IF…THEN…ELSE…ENDIF construct, and a SWITCH…CASE…ENDSWITCH construct.
RTB supports the traditional BASIC FOR loop, but also implements a new unified looping construct using the REPEAT…CYCLE construct with WHILE or UNTIL at the top or bottom of the loop.
Procedures and Functions
In addition to the traditional GOSUB…RETURN, RTB supports named procedures and functions with provision for local variables. These can also be called recursively.
RTB supports traditional Cartesian coordinate plotting as well as turtle graphics. There is also a sprite package. The graphics are available in 2 modes – a low and high resolution mode. There are 16 built-in named colours, but a full 24-bit colour pallet is supported.
On the Raspberry Pi, RTB provides access to the on-board GPIO pins using the standard wiringPi pinMode, digitalRead and digitalWrite statements. It also supports GPIO extensions via Arduino and various expansion chips such as shift-registers, I2C and SPI GPIO expansion chips.
Random and sequential access file handling is supported, as well as serial port access.