cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar

Working with Local Variables

Started ‎11-08-2022 by
Modified ‎11-08-2022 by
View Fullscreen Exit Fullscreen

Well now, let's take a quick look at local variables and using the local function. So I'm going to clear the contents of the Script Editor and I'm going to type local and open parentheses. And recall that the first argument is a list of the local variable names and I can either make the assignments in that list or that could be part of the JSL expression that is the second argument to the local function. I'm going to make the assignment in the list. So I'll open the curly brackets and JMP autocompleted that for me as well. And I'll type a equal comma q equal pi. And I'll open the parentheses. I'll type over the closing one. I'll type over that closing curly bracket. And because I'm just typing in the one line, I haven't moved my cursor elsewhere and then come back to this portion of the code. JMP recognizes that I'm just overwriting it's closed curly bracket, or the right hand curly bracket. And then, I'll type a comma after that first argument. And I'll type log and it's argument will be a times cosine, cos, and its argument will be q. Now before I run this-- I'll type my semicolon here as well. Before I run this, I'm going to hover over a, and you'll notice that a is storing a value of And I'll hover over q and you can see in the hover help that there is no value currently stored in q. I'm going to use these values to make my computation. So I'm going to run this script. The computation has been made. You see that it came out differently from the previous one above it in the log because that one was when had a value of times the log of times the cosine of pi. Now, its log of times the cosine of pi. So I have a different value. But in the script when I hover over a, we see that it is still storing The global variable a is still storing So this version of a only existed while my script ran. And if I hover over q, you can see that it's still empty. It's not storing a value. It only stored the value of pi long enough for this expression to evaluate.