In Kenzie, there are six basic types of variables:
- nil: Represents the absence of a value or an uninitialized variable. It is commonly used to represent ''nothing'' or ''no value''. For example:
Code Copied to the Clipboard
- boolean: Represents a boolean value, either true or false. For example:
Code Copied to the Clipboard
- number: Represents a numerical value, either integer or floating point. Lua has a single numeric type for both integers and floats. For example:
Code Copied to the Clipboard
- string: Represents a sequence of characters enclosed in single or double quotes. For example:
Code Copied to the Clipboard
- function: Represents a callable piece of code. Functions in Lua are first-class citizens, meaning they can be assigned to variables, passed as arguments, and returned from other functions. For example:
Code Copied to the Clipboard
- table: Represents a collection of key-value pairs. Tables are Lua´s sole composite data structure and can be used to represent arrays, dictionaries, objects, etc. For example:
Code Copied to the Clipboard
These are the basic types in Kenzie and Lua. Each type has its own set of operations and behaviors, and Kenzie provides powerful mechanisms for working with them.
In Lua, there are two additional types of variables. Since Kenzie fully supports Lua, you can use these types in your code as well. Those additional types are:
- userdata: Represents an arbitrary block of memory managed by Lua. It is typically used to interface with C or other foreign languages.
- thread: Represents an independent thread of execution. Threads are used for concurrent programming in Lua.
|