About Data Types

DScript supports the following types of data:

Data Types

Data DScript
Numbers See About Numbers in DScript.
Text strings See Text Strings.
Boolean values See Boolean Values.
Function pointers See Function Pointers.
Lists See Work with Lists.
Objects See Work with Objects.
Null See About the Null Value

While these are the same data types supported by standard JavaScript, DScript extends the definition of a number to include complex numbers and numbers with units of measure. DScript also extends its treatment of lists and objects so they behave exactly like the other, more basic data types.

Many of the primitives built into DScript can accept a wide variety of data types as input and adapt to the data you provide. For example, the Add operator (+) in the expression:

2+3                   // = 5

performs simple numeric addition. However, in the expression:

"Hello "+"world"               // = Hello world

the same operator performs text concatenation. Furthermore, in the expression:

[[1,2],[3,4]]+[[6,7],[8,9]] // = [[7,9],[11,13]]

the Add operator performs matrix addition.

See Add.