Return to homepage

DOSATO

Copyright © 2024 Sebastiaan Heins

2.1 Types

2.1.1 List of all types

Type Example Explanation
byte 100 Any whole number (8 bit)
short 10000 Any whole number (16 bit)
int 1000000 Any whole number (32 bit)
long 100000000000 Any whole number (64 bit)
float 1.5 Any decimal number
ubyte 255 Any whole number non negative (unsigned) (8 bit)
ushort 65535 Any whole number non negative (unsigned) (16 bit)
uint 4294967295 Any whole number non negative (unsigned) (32 bit)
ulong 18446744073709551615 Any whole number non negative (unsigned) (64 bit)
double 1.5 Any decimal number (twice as precise as a float)
bool true true or false
char 'a' Singular ascii character
string "Hello World" Any string of characters
array [1, 2, 3] List of values
object {"key": "value"} List of Key Value pairs
void Nothing Used to indecate no return on Functions
function define void func(){} Functions are first class citizens.

Type syntax

Intergers

An interger is a whole number.
Intergers can be positive or negative.

do say (100) // 100

Intergers literals are by default long, but when they overflow they become ulong.

Floats

A float is a decimal number.
Floats can be positive or negative.

do say (1.5) // 1.5
do say (1.5F) // 1.5 (float form)

Float literals are by default double, but can be specified with an F to become a float.

Booleans

A boolean is a value that can be either true or false.

do say (true) // true
do say (false) // false

Characters and strings

A character is a single ascii character.
A string is a sequence of characters.

do say ('a') // a
do say ("Hello World") // Hello World

Characters are surrounded by single quotes.
Which means you can't have more then 1 character in single quotes (unless escaped by \).
Strings are surrounded by double quotes.

do say ("Hello world!\n") // \n is converted to a new line character

You can also include new lines directly in strings.

do say ("Hello world!
This is a new line!")

Functions

Functions are first class citizens.
They can be assigned to variables, passed as arguments and returned from other functions.

define func() {
    do say ("Hello world")
}

do func() // Hello world
make other_func = func
do other_func() // Hello world