Language Elements

Top  Previous  Next

The DScript language resembles SQL and uses the following expressions to operate on conditions or data.

 

Arithmetic operators

The +, -, * and / characters are used to calculate values.

 

+

Addition: 5 + 5 = 10

-

Subtraction: 5 - 2 = 3

*

Multiplication: 5 * 2 = 10

/

Division: 10 / 2 = 5

 

Assignment operator

Depending on context, the = character is used as the assignment operator for settings variables to a specific value.

 

Concatenation operator

The || ("double-pipe") operator is used to concatenate strings. Using 'value1' || 'value2' in code, results in a single string value of 'value1value2'.

 

Logical operators

You can use NOT, AND and OR in combination in search conditions to create complex conditions.

 

Comparison operators

The =, <>, <, <=, >, >= symbols are used for comparing values.

 

Constant or Literal

String literals in single quotes, integer and floating point numbers and NULL. When written directly in the script, these are basically constants.

 

There's additional special literals, like the hex-string, a binary string made up of pairs of hex digits each defining a single byte. There's also the hexadecimal notation for number, which looks similar.

 

'test'

string literal

8932

integer number

8843.3232

floating point number

-9943

negative integer number

NULL

the state of not containing anything

x'A104C3'

A 3-byte string

0xA104C3

The hexidecimal representation of the decimal 10552515

 

Date/time literal

Specific date, time or date-time literals are strings in single quotes, with a DATE, TIME, DATETIME or TIMESTAMP prefix.

 

TIME'10:00:12'

12 seconds past 10 o' clock

DATE'2023-10-12'

12th of November, 2023

DATETIME'2023-10-12 10:00:12'

a combination of the above

 

Identifier

An object identifier is a string without single quotes but optionally with double quotes. When an object identifier is double quoted ("MyName"), the text becomes case sensitive. If you have special characters in an object name, like a space, the double quotes are required.

 

Statement separator

Statements are separated (or ended) by the semi-colon character: ;

 

Sub-routine

A locally declared subroutine inside a scripting block.

 

Variable

A local variable or an input or output parameter for the current scripting block or local subroutine.