That should be same, but it does look a bit weird. Using the modal example from Scripting Index:
This part is basically condition1 of the if:
ex = New Window("Dialog() example",
<<Modal,
<<Return Result,
V List Box(
H List Box("Set this value", variable = Number Edit Box(42)),
H List Box(Button Box("OK"), Button Box("Cancel"))
)
);
ex["button"] == 1;
And this is the result1
ex["variable"]
and returnElse:
"CANCEL"
And because those results and basically last lines which will be executed depending on the if condition result, they will be printed to Log. You can test this by following two short scripts:
a = 1; //will print 1 to Log as this is the only and last row in script
a = 1;
Write(); //will print this as it is the last row of code
And if you did mean how ex variable works, you can fairly easily check it by running the example in scripting index and add Show(ex) in the end.
Below is an example with the if statement made a bit more clear by adding brackets and comments and I also added Show() for ex variable:
Names Default To Here(1);
If(
( //condition1 starts
ex = New Window("Dialog() example",
<<Modal,
<<Return Result,
V List Box(
H List Box("Set this value", variable = Number Edit Box(42)),
H List Box(Button Box("OK"), Button Box("Cancel"))
)
);
ex["button"] == 1
), //condition1 ends
ex["variable"]; //result1
, //ELSE
"CANCEL" //returnElse
);
Show(ex);
(note due to the Show() "CANCEL" isn't the last line of code when Cancel is pressed and it won't get printed, this will also show you that the variable value will be updated even if cancel is pressed)
Hopefully I did explain everything correctly. You can find more info from JMP Help and Scripting Guide: Construct a Modal Window
-Jarmo