Keyword

Keyword

Keyword

Function

keyword is a word with special meaning in BT syntax and cannot be used as an ordinary variable name. They are used to declare variables, define functions, control conditions and loops, import object fields, etc.

Commonly used keywords

  • let: declare local variables.
  • fn: Define function.
  • return: Return from function.
  • if / elseif / else: conditional judgment.
- match: Match by value and return the hit branch.
  • try/catch/throw: Error catching and throwing.
  • for/while/loop: Loop.
  • in: for for ... in traversal.
  • break/continue: Control loop.
  • class/pub: Define classes and public members.
  • new: Used for Class::new() instantiation syntax.
  • use: Import object fields.

Syntax document

  • use: Import the fields in the object into the current scope.
  • Conditional statement : See if, ternary conditionals, and match expressions.
- Error handling : See try/catch and throw.