The Boa Programming Guide - Built-In Types

This page describes the basic types built into the Boa language.

Basic Types
TypeDescription
boolBoolean values (true, false)
float64-bit IEEE floating point values
int64-bit signed integer values
stringArray of Unicode characters
timeUnix-like timestamp, unsigned integer representing number of microseconds since 00:00:00 UTC 1 January 1970
Array Types This section not completed yet.
array of basic_type
Map Types This section not completed yet.
map[basic_type] of basic_type
Stack Types This section not completed yet.
stack of basic_type
Set Types This section not completed yet.
set of basic_type
Enum Types This section not completed yet.
type T1 = enum { A = "true", B = "false" }; t1 : T1 = T1.A;
Tuple Types
Tuples are containers of other basic types. They are declared by listing the types they contain, optionally with names to access each component. Tuple fields can also be accessed positionally with the field name f and the offeset, starting from 0.

type t = { i: int, s: string, b: bool };
tup: t = { 5, "string", false };
tup.f1 = "foo";
tup.b = true;

Type Conversions

Each basic type can be converted to each other using built-in functions with the same name as the destination type. For example, to convert a string to an int: int("123") or to convert a string to a time: time("Wed Jul 30 23:49:55 PDT 2003").

Note that these are type conversions and not type casts. Not only will the type change, but the value might change in the conversion as well.