z/OS UNIX System Services User's Guide
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Searching for opening and closing brackets

z/OS UNIX System Services User's Guide
SA23-2279-00

The characters (, [, {, and < can all be called opening brackets. When the cursor is resting on one of these characters, pressing the % key moves the cursor from the opening bracket to the corresponding closing bracket character ), ], }, and >, keeping in mind the usual rules for nesting brackets. For example, if you move the cursor to the first ( in:
if ( cos(a i ) > sin(b i +c i ) )
              {
                  printf("cos and sin equal!");
              }
 
and press %, you will see the cursor jump to the parenthesis at the end of the line. This is the closing parenthesis that matches the opening one.

Similarly, if the cursor is on one of the closing bracket characters, pressing % will move the cursor backwards to the corresponding opening bracket character.

Not only does this search character help you move forward and backward through a program in long jumps, but it also lets you check the nesting of parentheses in source code. For example, if you put the cursor on the first { at the beginning of a C function, pressing % should move you to the } that (you think) ends the function. If it doesn't, something has gone wrong somewhere.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014