Scripting Guide > JSL Building Blocks > Alternatives for Gluing Expressions Together
Publication date: 08/13/2020

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.

Want more information? Have questions? Get answers in the JMP User Community (community.jmp.com).
.