my list = {1, 2, 3};
your list = List( 4, 5, 6) ;
my matrix = [3 2 1, 0 -1 -2];
If( Y < 20, X = Y );
Table Box( String Col Box( "Age", a ) );
Note: To glue a sequence of commands into a single argument inside a function, separate each sequence with a semicolon. For more information, see Semicolons.
•
|
y = 10;
If(
Y < 20, X = Y,
X = 20
);
•
|
Open( "$SAMPLE_DATA/Big Class.jmp" );
•
|
Parentheses also mark the end of a function name, even when arguments are not needed. For example, the Pi function has no arguments. However, the parentheses are required so that JMP can identify Pi as a function.
|
Pi();
The script editor can match fences (parentheses, brackets, and braces). Press CTRL-] (COMMAND-b on Macintosh) with your cursor in any part of a script. The editor searches for fences, highlighting the text between the first set of opening and closing fences that it finds. Repeat this process to highlight the next-higher fence. See Match Parentheses, Brackets, and Braces for an example.
Expressions separated by a semicolon are evaluated in succession, returning the result of the last expression. In the following code, 0 is assigned to the variable i and then 2 is assigned the variable j.
i = 0;
j = 2;
You can also use semicolons to join arguments that are separated by commas as shown in the following If() expression.
If( x < 5, y = 3; z++; );
The semicolon in other languages is used as an expression terminator character. In JSL, the semicolon is a signal to continue because more commands might follow. For details about separating expressions with semicolons, see Alternatives for Gluing Expressions Together.
The semicolon is equivalent to the Glue() function. See Operators for more information about semicolons and Glue().
Double quotes enclose text strings. Anything inside double quotes is taken literally, including spaces and upper- or lower-case; nothing is evaluated. If you have "Pi() ^ 2" (inside double quotes), it is just a sequence of characters, not a value close to ten.
To have double quotes inside a quoted string, precede each quotation mark with the escape sequence \! (backslash-bang). For example, run the following script and look at the title of the window:
New Window( "\!"Hello\!" is a quoted string.",
Text Box( Char( Repeat( "*", 70 ) ) )
);
\!b |
|
\!t |
|
\!r |
|
\!n |
|
\!N |
|
\!f |
|
\!0 |
|
\!\ |
|
\!" |
Sometimes, long passages require a lot of escaped characters. In these cases, use the notation \[...]\ and everything between the brackets does not need or support escape sequences. Here is an example where \[...]\ is used inside a double-quoted string.
jslPhrase = "The JSL to do this is :\[
a = "hello";
b = a|| " world.";
Show(b);
]\ and you use the Submit command to run it.";
Spaces inside an operator or between digits in a single number are not allowed. In these cases, the script generates errors. For example, you cannot put spaces between the two plus signs in i++ (i+ +) or in numbers (4 3 is not the same as 43).