Skip to content

Types

Basic Types

Basic types are treated differently in OneScript in that they are directly supported by the Macro Virtual Machine and operations performed on them can be faster.

Numbers

Numbers can be either integers or floating point values. The following number types are supported:

Name Bit Size Description Min Value Max Value
byte 8 An 8 bit integer. -128 127
int 64 An integer as defined by the basic operating system which is more commonly a 64 bit integer.
float 64 A floating point value.

Numbers can be declared in the following way:

byte smalNumber = 23;
int bigNumber;
float realNumber = 3.4

Strings

Strings are Unicode by default. A basic string is delimited by double quotes ("). For example:

string stringValue = "Hello World";

It is possible to add in special characters using the backslash (\). For example:

string welcome = "Hello\r\nWorld";

The above will display the following:

Hello
World

Special characters include the following:

Format Name
\ Backslash
\' Single quote
\" Double quote
\n New line
\r Carriage return
\t Tab
\xnnnn Hex value for a character where nnnn is a hexadecimal number.
\unnnn Hex value for a character where nnnn is a hexadecimal number.
\Unnnnnn Hex value for a character where nnnnnn is a hexadecimal number.

Strings can also cover multiple lines using the ampersand (@) prefix. For example:

string welcome = @"Hello
World";

Strings can be concatenated by using the addition operator (+). For example:

string welcome = "Hello";
welcome = welcome + " world";

Boolean Values

Boolean values can either be true or false.