Version: v0.7.1 - Beta.  We welcome contributors & feedback.


THT has shortcuts and other syntax that let you compress common patterns into more concise code.

Print >> 

To make debugging with print statements easier to type, you can use the one-line >> shortcut instead.

>> 2 + 2

// is the same as...

print(2 + 2)

Quoted (Quick) Lists 

A list prefixed with q will automatically convert the contents to a list of strings.

The tokens are separated by whitespace (spaces or newlines).

// Same as ['red', 'blue', 'green']
$colors = q[red blue green]

// Same as ['red apple', 'blue ocean', 'green field']
$colors = q[
    red apple
    blue ocean
    green field


When you have a block containing a single statement, you can use a colon : to place it on the same line without curly braces.

if $a == 1: print('One!')

fn addOne($n): return $n + 1

foreach $colors as $c: print($c)

// Example nesting (try not to overdo it)
foreach $nums as $n: if $n < 10: print($n)


If you are assigning the value of a method call to the same variable, you can leave out the variable before the dot (.).

$str = .upperCase()

// is the same as...

$str = $str.upperCase()

Method calls can be chained as normal.

$str = .upperCase().reverse()