Our World Statistics Day conversations have been a great reminder of how much statistics can inform our lives. Do you have an example of how statistics has made a difference in your life? Share your story with the Community!
Choose Language Hide Translation Bar
Highlighted
tom_abramov
Level V

Folding simple commands in JSL

Hi,

I know that I can fold my code with additional folding keywords.

But if I have simple commands, what is the best way to fold / which keyword to use?

For example, I would like to fold the following code:

 

 

print ("a");
print ("b");

 

 

I can use Function keyword to fold but this solution doesn't seem to be perfect.

 

Run_Print = Function( {}, 
	Print( "a" );
	Print( "b" );
);

Run_Print();

 

 

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
txnelson
Super User

Re: Folding simple commands in JSL

You need to add your request for a Fold() type function to the JMP Wish List

Jim

View solution in original post

4 REPLIES 4
Highlighted
txnelson
Super User

Re: Folding simple commands in JSL

I am looking for some clarification. Do you want each Print function to have it's own fold, or are you wanting to have a simple method to take just be able to group several lines of code and have that defined as a fold? Or are you having a specific issue with the syntax error in the function you specified in your discussion entry?

 

It might be nice to have a keyword function called Fold() that when specified, does nothing more than to place whatever code is in the function into a fold, but not have to actually specify that it needs to be called after it is defined....

Fold(
	Print( "a" );
	Print( "b" );
);

But short of that, I believe the easiest way to do this is to use an Expr() to isolate the code

Run_Print = Expr(
	Print( "a" );
	Print( "b" );
);
Run_Print;
Jim
Highlighted
tom_abramov
Level V

Re: Folding simple commands in JSL

Thanks Jim,

I would like to "group several lines of code".

Working with Function keyword or with Expr is ok, but 

Fold() or something like this will be better.

May be in JMP 16 

 

Highlighted
txnelson
Super User

Re: Folding simple commands in JSL

You need to add your request for a Fold() type function to the JMP Wish List

Jim

View solution in original post

Highlighted
johnmoore
Level IV

Re: Folding simple commands in JSL

I use expr() to fold blocks but it has similar issue.

Article Labels