A.6   Declaration Formats

Include only one declaration per line. Declarations are indented in accordance with Indentation, and begin at the current indentation level. The remainder of this section describes the declaration formats for variables and procedures.

Variables

For global variables, the Tcl set command appears first on the line, separated from the identifier by a tab character. Complete the declaration with a meaningful comment at the end of the same line. Variables, values, and comments should be aligned, as in the following example:

set     rootMemNBytes     0  ;# memory for TCB and root stack 
set     rootTaskId        0  ;# root task ID 
set     symSortByName     1  ;# boolean for alphabetical sort

Procedures

The procedure name and list of parameters appear on the first line, followed by the opening curly brace. The declarations of global variables used inside the procedure begin on the next line, one on each separate line. The rest of the procedure code begins after a blank line. For example:

proc lstFind {list node} { 
    global firstNode 
    global lastNode 
 
    ... 
}