# Type ## Function BT is a dynamically typed language. The variable itself has no fixed type, and the value carries the type at runtime. You can use `type(value)` to view script-visible type names. ## Syntax ```bt type(value) ``` ## Built-in base type | Type | Description | | ------ | ------ | | `Int` | Integer. | | `Float` | Floating point number. | | `Bool` | Boolean value. | | `String` | String. | | `Array` | Array. | | `Object` | Object. | | `Null` | Explicit null or failure value. | | `Empty` | Missing value. | | `Regex` | Regular expression. | | `Fn` | Function. | | `Class` | Class. | | `Instance` | Class instance. | ## Standard library object type | Type | Description | | ------ | ------ | | `Fs` | File system object. | | `Date` | Date and time object. | | `Math` | Global math object. | | `Base64` | Base64 encoding and decoding object. | | `Mysql` | MySQL builder object. | | `Reqwest` | HTTP request builder object. | | `Process` | Process builder or child process object. | | `Net` | Network service or connection object. | | `Device` | Device communication object. | ## The undefined extended object type extended object returns the object type name declared by `objects[].name` in `bindings.json`. The internal identity of the extension object is still managed by the host using the module ID, type ID, and object ID, and the scripting layer only sees the readable, comparable type name. ```bt db = sqlite_open('@/data/demo.db', {}) query = db.query('SELECT 1') // Output: Sqlite print type(db) // Output: SqliteQuery print type(query) ``` ## Code Examples ```bt // Output: Int println type(123) // Output: String println type('BT') // Output: Array println type([1, 2, 3]) // Output: Object println type({name: 'BT'}) ``` ## Type conversion ```bt int('12') float('12.5') string(123) bool(1) array('abc') object('{"name":"BT"}') ``` ## Notes - `empty` represents missing values: the expression has no output, the variable is not initialized, the field or subscript does not exist, and the function parameter is not passed in. - `null` represents an explicit null or failure value: user-written `null`, JSON null, database NULL, parsing or conversion failure. - `json(empty)` or an array or object containing `empty` will output the standard JSON `null` when serialized to JSON. - The extended object returns the specific object type name, such as `Calc`, `Sqlite`, `SqliteQuery`, and no longer returns the unified `ExtObject`.