•
|
•
|
prefix (with one argument on its right side, such as !a for logical negation)
|
•
|
The assignment operation can be written either as the Assign() function or as an infix operator =. Similarly, subtraction can be done with the Subtract() function or the infix minus sign; they are equivalent inside JMP.
注意:Usually white space is ignored in JSL, so that “netincomeaftertaxes” and “net income after taxes” are the same thing. There is one exception: the two-character operators must not have a space between characters. Always enter the following operators without spaces in between:
|
Another common operator is the semicolon ( ; ). You use the semicolon to:
•
|
An expression can contain more than one operator. In these instances, the operators are grouped in order of precedence with decreasing priority. For example, * takes precedence over +:
+ takes precedence over -:
So b * c is evaluated, and then the result is added to a. d is then subtracted from the result of a + b * c.
Operators and Their Function Equivalents in Order of Precedence shows operators shaded in order of precedence and each operator’s function equivalent.
List(a,b)
|
|||
Subscripts identify specific elements within a data element a, where a could be a list, a matrix, a data column, a platform object, a display box, and so on.
|
|||
a++
|
Adds one (1) to a, in place.
JMP does not have a pre-increment operator. Instead, use the Add To() operator, which is (+=).
|
||
a– –
|
Subtracts one (1) from a, in place.
|
||
a^b
Power(x)
|
Raise a to exponent power b. With only one argument, 2 is assumed as the power, so Power(x) computes x2.
|
||
–a
Minus(a)
|
|||
!a
Not(a)
|
|||
a*b
|
|||
a:*b
|
Elementwise multiplication for matrices a and b. (Each element in matrix a is multiplied by each element in matrix b.)
|
||
a/b
Divide(x)
|
Divide(x) interprets the argument as a denominator and implies 1 as the numerator, yielding the reciprocal 1/x.
|
||
a:/b
|
Elementwise division for matrices a and b. (Each element in matrix a is divided by each element in matrix b.)
|
||
a+b
|
|||
a–b
|
|||
a||b
|
Joins two or more strings; two or more lists; and horizontally concatenates matrices. See “Concatenate Lists” on page 182 in the “Data Structures” chapter or the JSL Syntax Reference for details.
|
||
matrix1|/matrix2
|
|||
a::b
|
(Colons are also used as prefix operators for scoping, where :a means data table column a, and ::a means JSL global variable a. See Scoping Operators for details.)
|
||
a==b
|
Boolean values for comparisons. They all return 1 if true, 0 if false. Missing values in either a or b causes a return value of missing, which evaluates as neither true nor false. See Missing Values, for treatment of missing values.
|
||
a!=b
|
|||
a<b
|
|||
a<=b
|
|||
a>b
|
|||
a>=b
|
|||
Range check. Return 1 if true, 0 if false. Missing values in either a or b propagate missing values.
|
|||
a<b<=c
|
|||
a&b
|
Logical And. Returns true if both are true. If the value on the left is false, the value on the right is not evaluated. See Missing Values, for treatment of missing values.
|
||
a|b
|
Logical Or. Returns true if either or both are true. See Missing Values, for treatment of missing values.
|
||
a=b
|
|||
a+=b
|
|||
a– =b
|
|||
a*=b
|
|||
a/=b
|
|||
a;b
|