The Xill scripting language is an imperative language without types, user-defined classes or inheritance. Each command is closed by a semicolon ; .

Variables and functions

Variables are defined using the keyword var. For reassignment, this keyword is not used. Functions are defined using the keyword function. Literal strings must be enclosed in double quotes " . Examples:

var a = "example";
a = "some new value";

function doSomething () {
[...]
}

Built-in functions come in plug-in packages. All used packages are declared at the start of a robot, with the use keyword:

use System;

After this declaration, the functions are available as [package name].[function name]([parameters]). Functions are called with zero or more comma-separated arguments:

System.print("Hello World");
doSomething();

Operators

Operators can be used to perform simple actions like concatenating, multiplying, etc:

a = b + 1;

A special operator is the concatenation operator :: which is used to concatenate literal strings and variables (in any combination and order).

System.print("Hello " :: "Xillio!");

Expressions

Expressions are sequences of variables or functions connected by operators. They can be nested into function parameters, thus creating complex expressions.

Simple expression

var a = fac(1);

Complex expression

var b = fac(a + fac(a - 1)) / 2;

Code blocks

Curly braces {} are used to enclose code blocks that are executed when specific conditions are met, such as if, foreach, while and function

if(true) {
    System.print("Hello world!");
} else {
    System.print("Goodbye!");
}

Variable scope

The scope of variables is bound to the block in which they have been defined. This implies that a variable can be accessed in a sub block, but not in a super block.   

use System;
var scope1 = true;
 
if(true) {
    var scope2 = true;
    System.print("Current block accessible: " :: scope2);
    System.print("Super block accessible: " :: scope1);
}
System.print("Subscope accessible: " :: scope2);

This code will give a compile time error, telling us that scope2 (on the last line) couldn't be resolved.

System variables

The following set of variables are considered system variables. These variables are globally available, and immutable. They always have the value represented by their name.

  • true
  • false
  • null

Links

All language documentation

Tutorials and example use cases