Skip to content
This repository was archived by the owner on May 21, 2026. It is now read-only.

Data Types

Austin Lehman edited this page Oct 23, 2022 · 1 revision

Aussom has 9 basic data types. The data types are null, bool, int, double, string, list, map, callback, and object. In this section we will provide a basic description of each.

null:

Null is a placeholder for nothing. In other languages such as C null literally means 0. In Aussom, null simply means nothing. In an expression null equates to false. You may assign null or check for null.

myVar = null;
if(myVar == null) { /* Do something */ }

bool:

Bool is a boolean (true/false) value. A variable can be set as a boolean value by using either the 'true' or 'false' key worlds. Here are a few examples.

mybool = true;
if(true) { /* This will run. */ }
if(mybool) { /* This will run. */ }
if(false) { /* This won't run. */ }

int:

Int is a integer value. Underneath, Aussom represents an integer value as a Java long, which is a 64 bit integer.

num1 = 1;
num2 = -23456;
num3 = 2345566823434;
num4 = 0;

double:

Double is a double precision floating point value. A double in Aussom is the same as a double in Java.

dbl1 = 1.0;
dbl2 = -57392.238432532;
dbl3 = 1238435.23234325;
dbl4 = 0.0;

string:

A string is equivalent to Java's String object. It can hold any number of characters. String can be defined with single or double quotes. You can use double quotes within a single quoted string, or single quotes with a double quoted string. If you want to use the quote symbol that the string is quoted with, you must escape them. Here are a few examples.

sone = "Hello World!";
stwo = "It's a fine day.";
sthree = 'Here is a "double quote" within a string.';
sfour = "Example of an excaped \"quoted\" string!";

list:

A list is what it sounds like. A list contains any number of other variables. Lists do not need to contain variables of the same type. Various operations can be performed on a list and they can be appended to dynamically. Lists are generally indexed by an integer value.

myList = [];		// Create a new list dynamically
myList @= "Hi There";	// Append a string to the list.
myList @= 10;		// Append an integer to the list.
#myList			// The # symbol gets the length or number of items in a list.
myList[0]		// The 0 based index of the list holds "Hi There" as a value.

map:

A map is a group of variables that are set and referenced by a key. Sometimes these are referred to as associative arrays. The map data type implemented in Aussom uses strings as keys for the map, and the value can be any data type.

myMap = {};				// Define a new map
myMap['name'] = "Austin";		// Set a value of "Austin" as name.
myMap['name'] = "Tyler Durden";		// Set's the 'name' key to value of "Tyler Durden".
sys.println(myMap['name']);		// Will print "Tyler Durden".

callback:

A callback is a reference to a function. When you create a callback, you can give the callback to another function to call at a later time, or you can call yourself using reflection module. The '::' operator is used with a following string to define a callback. More on callbacks in the callback section.

Given that we have a function:

public makeSoap() { ... }

We can do:

myCallback = ::makeSoap;

And we can pass it to a function like:

someObject.registerCallback(myCallback);
or
someObject.registerCallback(::makeSoap);

object:

The object data type is the most versatile data type. An object is any instance of a class. So you can basically make it anything you like. In our hello world, our helloWorld class is an object once instantiated. We just need to use the 'new' key world to instantiate the class and it will then be an object. Here's an example of creating our helloWorld object.

myObj = new helloWorld(); 	// Creates a new instance of the helloWorld class and
				// calls the constructor if present. If arguments are
				// provided they are given to the constructor.

myObj.doSomething("Arg");	// Call a public function of the instantiated object.
sys.println(myObj.name);	// Dereferences a public member variable 'name' and prints
				// to the console.

Clone this wiki locally