Inserting J code

 

Inserting J code

For certain template properties, it is possible to insert J code, which will be evaluated when the template is run.

 

To write J code, the user has two possibilities:

·         Simple use of string concatenation, using the “+” operation (for example, Name+"class").

·         The use of an anonymous method, using {} to contain more complex code. This is used notably to declare variables and to use statements. In this case, the calculated string must be returned. An example is shown below.

 

{

    String result;

    if (ClassOf == Class) {

        result.strcat ("Class ", Name);

    } else {

        result.strcat (Name);

    }

    return result;

}

 

For more information, please see the “Objecteering J Libraries” and “Objecteering J Language” user guides.