Using Code Templates

In this section you will use content assist to fill in a template for a common loop structure. Open TestPackage.maple file in the Maple editor if you do not already have it open.

  1. Start adding a new for loop statement. With the cursor at the end of for, press Ctrl+Space to enable content assist.  You will see a list of common templates for "for" loops.  When you single-click a template, or select it with the Up or Down arrow keys, you'll see the code for the template in its help message.

    Maple Editor - Content assist for Maple For statement
  2. Choose the for - iterate over the operands of an expression entry and press Enter to confirm the template.  The template will be inserted in your source code.

    Maple Editor - Inserted for loop template
  3. Next we change the name of the variable from var to a. To do so simply press Ctrl+Space to open Quick Assist popup. From the list of all available variables (export, local etc.) select local variable a and press Enter.

    Maple Editor - Altered for template

  4. Pressing the tab key moves the cursor to the next variable of the code template.