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.

Each feature will be demonstrated using XCSL literal values, but in practice named constants/functions can be used in place of literals.


Table of Contents


Arithmetic

For the purpose of demonstration, all literal arithmetic will result in the value: 8

Addition

4 + 4

Subtraction

11 - 3

Multiplication

4 * 2

Division (Quotient)

16 / 2

Division (Remainder)

17 % 9


Bitwise Operations

For the purpose of demonstration, all bitwise arithmetic will result in the value: 8

Shift Bits Left

1 << 3

Shift Bits Right

16 >> 1

Bitwise And

15 & 8

Bitwise Or

8 | 0

Bitwise Exclusive Or (Xor)

15 ^ 7


Logical Operations

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

Logical And

True && True

Logical Or

True || False

Logical Xor

False ^^ True

Less Than

3 < 5

Less Than or Equal To

5 <= 5

Greater Than

7 > 5

Greater Than or Equal To

6 >= 6

Equal To

False == False
1 == 1

Not Equal To

True != False
1 != 2


List and String Operations

For purpose of demonstration, each string operation will result in "Hello User!".

Construction

'H' : "ello User!"

Concatenation

"Hello " ++ "User!"