Glue() and If() are – almost – completely unrelated, so it's hard to compare them.
Glue
In all honesty, you can ignore Glue() and be a very successful JSL programmer. So, if this confuses you, don't worry about it.
JSL is a functional language. That is, everything(ish) in JSL is a function. Some functions in JMP have operator forms.
For example, the function to assign a value to a variable is Assign(a, b), which assigns the value of b into a. There is an operator form of that using an = sign:
a=b
The function that puts expressions together into something that can be evaluated is Glue(), as in:
Glue(Assign(a,b), Add(c,d))
The operator form of Glue() is a semicolon (;), the following is the equivalent of the above:
Assign(a,b);
Add(c, d)
If
In any programmming language you need constructs to make decisions. In JSL, as in other languages, these are condtional functions.
If() takes at least three arguments:
- a condtional
- true result
- else result
I find it easiest to understand If() by looking at it's prototype in the Formula Editor.
Notice the first "expr" there. That's the condition to be tested and it's the first argument. The second argument, the "then clause", is the expression that should be evaluated if the condition is true. The third argument is the "else clause," the expression to be evaluated if the condition isn't true.
Outside of the formula editor this looks like:
If( a == "some value",
Show( "True" ),
Show( "False" )
);
So, this tests the condition that a is equal to "some value" and shows "True" if it is and "False" if it isn't.
Each of the clauses can contain multiple statements, separated by semicolons (;).
I hope this helps clear up some confusion.
If you've got more questions, let us know.
-Jeff