* comment * This is an example of how to use include blocks to load a set of .tips files at once. The NEdit macro language tips are split into files with tips for the subroutines and the action routines. Both these files are then included in this file. . NOTE: These files are NOT religiously maintained and may be out of date. Please report any errors or omissions to develop@nedit.org. . You'll need to change the include lines below to point to the location where you installed the .tips files. * include * ~/.nedit/tips/nedit_subroutines.tips ~/.nedit/tips/nedit_act_routines.tips * language * NEdit Macro define Users can define their own macro subroutines, using the define keyword: . define subroutine_name { < body of subroutine > } . Macro definitions can not appear within other definitions, or within macro menu item definitions (usually they are found in the .neditmacro file). . The arguments with which a user-defined subroutine or function was invoked, are presented as $1, $2, ... , $9. The number of arguments can be read from $n_args. . To return a value from a subroutine, and/or to exit from the subroutine before the end of the subroutine body, use the return statement: . return for for (, ...; ; , ...) , as in C, can be a single statement, or a list of statements enclosed in curly braces ({}). is an expression which must evaluate to true for the statements in to be executed. for loops may also contain initialization statements, , executed once at the beginning of the loop, and increment/decrement statements (or any arbitrary statement), which are executed at the end of the loop, before the condition is evaluated again. . Loops may contain break and continue statements. A break statement causes an exit from the innermost loop, a continue statement transfers control to the end of the loop. while while () , as in C, can be a single statement, or a list of statements enclosed in curly braces ({}). is an expression which must evaluate to true for the statements in to be executed. if if () if () else , as in C, can be a single statement, or a list of statements enclosed in curly braces ({}). is an expression which must evaluate to true for the statements in to be executed. in To determine if a given key is in an array, use the in keyword. if ("6" in x) . If the left side of the in keyword is an array, the result is true if every key in the left array is in the right array. Array values are not compared. . To iterate through all the keys of an array use the for looping construct. Keys are not guaranteed to be in any particular order: . for (aKey in x)