Skip to content

Basic Operations

Cody Fagley edited this page Jun 6, 2019 · 3 revisions

Basic Operations

This page covers basic XCSL operations that can be performed on data. The definitions for these operations are always included with a standard XCS installation.


Table of Contents


Arithmetic

For the sake of consistency/usability, all literal arithmetic will result in the value: 8

Addition

Literals
4 + 4

Variables
x + y

Subtraction

Literals
11 - 3

Variables
x - y

Multiplication

Literals
4 * 2

Variables
x * y

Division (Quotient)

Literals
16 / 2

Variables
x / y

Division (Remainder)

Literals
17 % 9

Variables
x % y


Bitwise Operations

Shift Bits Left

Literals
1 << 3

Variables
x << y

Shift Bits Right

Literals
16 >> 1

Variables
x >> y

Bitwise And

Literals
15 & 8

Variables
x & y

Bitwise Or

Literals
8 | 0

Variables
x | y

Bitwise Exclusive Or (Xor)

Literals
15 ^ 7

Variables
x ^ y


Logical Operations

Logical operations always result in True or False. For demonstration purposes, the result of all literal operations will be True.

Logical And

Literals
True && True

Variables
x && y

Logical Or

Literals
True || False

Variables
x || y

Logical Xor

Literals
False ^^ True

Variables
x ^^ y

Less Than

Literals
3 < 5

Variables
x < y

Less Than or Equal To

Literals
5 <= 5

Variables
x <= y

Greater Than

Literals
7 > 5

Variables
x > y

Greater Than or Equal To

Literals
6 >= 6

Variables
x >= y

Equal To

Literals
False == False
1 == 1

Variables
x == y

Not Equal To

Literals
True != False
1 != 2

Variables

Clone this wiki locally