Basic syntax
Basic syntax
Function
This page introduces the most basic writing rules of BT code. BT adopts an intuitive syntax similar to JS, while retaining the language mechanism of "expressions have return values".
Statement
usually writes one statement per line, and can also be separated by semicolons.
name = 'BT' age = 1; println age
Code block
Curly braces {} wrap multi-line statements. The value of the code block is determined by the last statement.
value = if true { a = 1 a + 1 }
Literal
1 1.5 'text' "text" true false null empty [1, 2, 3] {name: 'BT'}
Chained call
Objects, arrays, strings, HTTP clients and other capabilities support chained calls.
text = ' bt '.trim().to_uppercase()