Lets face it, JSL isn't the most user friendly language to use. It is mostly designed for you to back up your data after working on a lengthy project. With that being said, there are many usefull things you can do with it. This thread is dedicated to the basics of JSL. If I leave out some things, and I will, please feel free to reply and help out the users of JMP, so it isn't as hard as it was for me to learn JSL.
Functions:
Functions are a good way of reusing code if you need to use it over and over. The functions in JSL have all the things you would expect, a specific user set name, input parameters, and a return value. This function also shows how to parse a comma delimited text file. Syntax below.
funcName = Function( {param1},
{return1},
textFile = Load Text File( param1 ); // Reads a text File called param1
// Parses through the file which is comma delimited and gets a list of words
return1 = Words( textFile, "," );
);
To Call the function and assign the return value:
wordss = funcName( "fileName.txt" )
If Statemens:
The if statement works sort of like you would expect, but the syntax is a little different. Here is an example:
For Loops:
The for loops are very similar to the traditional for loop. It has the three part syntax with the chunk that gets looped. The first chunk is for initialization, the second is conditional, the third is the "Do after loop" chunk. It will make more sense in a second.
In JSL a fourth chunk is added which is all statements to be executed. Syntax below:
This is just the basics, I will add more to this thread later. Hopefully people contribute to make it very benificial. Thanks all.
-KaptainKodie