<pg-code>

The <pg-code> tag contains the PG source for a <webwork> problem. This is the WeBWorK Problem Generator code that defines randomization, answer checking, and any problem-specific logic.

Keep supporting macro libraries in <pg-macros>, and put the actual PG program in <pg-code>.

Syntax

Attributes

This tag has no attributes.

Children

The following may appear as children: Text

Parents

This element may appear as an immediate child of the following elements: <webwork>

Examples

<exercise>
    <webwork>
        <pg-code>
            $a = random(1,10);
        </pg-code>
        <statement>
            <p>
                What number am I thinking of?  <var name="$a"/>
            </p>
        </statement>
    </webwork>
</exercise>