The primitive types in Limbo have fixed definitions, that is, they are of the same size for all platforms. This is a requirement for portability. Table 2-4 shows these data types, their range, and meaning.
byte
| Unsigned 8-bit | Byte-length integer |
int
| Signed 32-bit | Integer |
big
| Signed 64-bit | Long integer |
real
| 64-bit IEEE long floating point | Double-precision floating point |
s := "Inferno";This declares
s to be a string and assigns it the value Inferno.
Inferno does not use the ASCII character set, but rather the Unicode character set, so a string type in Limbo is a vector (array) of Unicode characters. Each Unicode character is 16 bits.
There is no special "character" type in Limbo. A single character is enclosed in single quotes and is represented by its integer value. For example:
c := 'I';This statement delcares
c to be the integer value of the letter I, which is 73.
You can extract a range from a string, called a slice. See Array Slices later in this section for more information.
con keyword.
data: con "/data/user.dat"; # string constant block: con 512; # int constant pi: con 3.1415926535897932; # real constant
iota value with the con keyword to declare a constant value one greater than the previous value to a group of identifiers. It is similar to enumerations in C.
Mon, Tue, Wed, Thu, Fri, Sat, Sun: con iota;This statement declares
Mon to be a constant value of 0, Tue to be 1, Wed to be 2, etc.
You can use other operators with iota to change the starting value and increment values. The most commonly used operators are addition (+), multiplication (*), and bitwise shift (<< and >>) operators.
Ten, Eleven, Twelve: con iota+10;This sets the starting value to 10 and increases the subsequent values by one.
You can use the multiplication operator (*) to change the increment value. For example:
Zero, Five, Ten, Fifteen: con iota*5;You can also use the bitwise shift operators. For example:
Two, Four, Eight, Sixteen, ThirtyTwo: con 2<<iota;There are many variations that can be produced using a combination of operators.