Data types and variables
DPUSER knows about 6 different data types:
-
integer numbers
-
real numbers
-
complex numbers
-
up to 3-dimensional matrices
-
strings
-
string arrays
Those types are cast dynamically. So if you do a
print acos(2),
the result will not be integer (which would not make sense), but a complex
number. Complex numbers can be constructed by appending an
i (without
spaces) to a number:
variable = 1 + 2i
Strings are defined by embracing in double quotes:
variable = "This is a string".
Variable names can include any letter in the range [a-zA-Z] and numbers
[0-9] but must not begin with a number. Variables are created on the fly
by assigning a value to them. If you supply a value to an already existing
variable, it is overwritten:
n = 1
// n is an integer number
n++
// n is still integer with value 2
n = sqrt(n)
// n now is a real number
n = -(n^2)
// n is still a real number with value -2.0
n = n^(1/2)
// n now is a complex number
n = "a string"
// n is a string with value "a string"
n = fits(100, 100) //
n is now a matrix with 100x100 elements