Prev: Language
Data Types
m supports the following data types:
- Number: numbers have a range of roughly -10308 to 10308 and have a precision of almost 17 decimal digits[1].
- String: strings are sequences of characters[2]. Strings are immutable: their length is fixed, and individual characters cannot be changed. However, there are many builtin functions (see module ) manipulating strings.
- Boolean: booleans are logical values, i.e. either true or false. For instance, the result of a comparison is of Boolean type. Booleans are also often used as flags or to denote options for functions.
- Array: arrays are collections of arbitrarily many values. Multidimensional arrays (e.g. matrices) are constructed as arrays of arrays. In m, arrays are dynamic in size. Elements can be appended or removed. Elements can be indexed by numbers or strings ("associative array"). See also section * ().
- Class Instance: an instance of a class (an object). Class instances are at the center of object oriented programming (OOP) in m. Chapter * () explains m's OOP features.
- Null: this special type denotes an uninitialized or unspecified value. The only value of this type is null.
- Function Reference: a reference ("pointer") to a function. The reference can be used to specify callback functions, or to implement a simple polymorphism scheme.
- Instance Function Reference: a reference to a function of a class instance. The reference can be used to specify callback functions operating directly on class instances.
- Native Objects: are created by modules which are tied closely into the underlying operating system, e.g. by module io. Native objects can only be assigned and compared for identity.
Next: Comments© 2004-2011 airbit AG, CH-8008 Zürich
Document AB-M-REF-887