Scripting Guide > JSL Building Blocks > Alternatives for Gluing Expressions Together
发布日期: 04/13/2021

Alternatives for Gluing Expressions Together

You can separate expressions with a semicolon, either on the same line or on different lines. JMP then evaluates each expressions in succession, returning the result of the last one. Here is an expression that first sets a to 2 and then sets b to 3:

a = 2;
b = 3;

The semicolon joins the two expressions and returns the value of the last one. So if x = (a = 2; b = 3), the value of x is 3.

The Glue() function returns the result of the last expression. This function is equivalent to using semicolons. The following expressions both return 3:

Glue( a = 2, b = 3 );
a = 2; b = 3;

The First() function also evaluates each argument sequentially but returns the result of the first expression. The following expression returns 2:

First( a = 2, b = 3);

Example

What does First() do in the following script?

x = 1000;
First( x, x = 2000 );

The First() function returns the value of x (1000). 2000 is then assigned to x.

需要更多信息?有问题?从 JMP 用户社区得到解答 (community.jmp.com).