Cheat Sheet for Experienced Programmers

TMBASIC is a statically- and nominally-typed BASIC language. Roughly speaking, it is a cross between QBASIC and Visual Basic (pre-.NET).
┌─ Supported features ─────────────────────────────────────────────────┐
│  √ Statically typed (vs. dynamic)        √ if, for, for each, while  │
│  √ Nominal type system (vs. structural)  √ print, input              │
│  √ Exception-based error handling                                    │
└──────────────────────────────────────────────────────────────────────┘
┌─ Unsupported QBASIC features ─┐ ┌─ Unsupported VB features ────────┐ │ No line numbers │ │ No object oriented programming │ │ No "goto" │ │ No multithreading │ │ No "peek" or "poke" │ │ No graphics or sound support │ │ No type suffixes, like $ │ │ No interop with C/C++ │ └───────────────────────────────┘ └──────────────────────────────────┘

Data types

There are no object or reference semantics in TMBASIC, and thus no real support for object oriented programming (OOP). Everything is a value. Assigning to a variable always makes a copy, even for records, lists, and maps. Procedure parameters are passed by value. Internally, TMBASIC uses immutable data structures to make this efficient.

Sample code

if statements

sub FizzBuzz(n as Number)
dim fizz = (n mod 3) = 0
dim buzz = (n mod 5) = 0
if fizz and buzz then
print "FizzBuzz"
else if fizz then
print "Fizz"
else if buzz then
print "Buzz"
else
print n
end if
end function
sub Main()
dim n as Number
print "Enter a number, or 0 to quit: ";
input n
if n <> 0 then FizzBuzz n
end sub

Build a list efficiently with dim list

function Fibonacci(count as Number) as List of Number
' No explicit type needed when providing an initial value.
dim a = 0
dim b = 1
' Use "dim list" and "yield" to build the list to be returned.
dim list numbers
yield a
yield b
for i = 3 to count
dim c = a + b
yield c
a = b
b = c
next
end dim
return numbers
end function
sub Main()
for each n in Fibonacci(50)
print n
next
end sub