contextABCD.pl - Contexts for matching problems.

From WeBWorK

Jump to: navigation


NAME

contextABCD.pl - Contexts for matching problems.

DESCRIPTION

Implements contexts for string-valued answers especially for matching problems (where you match against A, B, C, D, and so on).

There are two contexts defined here,

        Context("ABCD");
        Context("ABCD-List");

The second allows the students to enter lists of strings, while the first does not.

You can add new strings to the context as needed (or remove old ones) via the Context()->strings->add() and Context()-strings->remove() methods, eg.

        Context("ABCD-List")->strings->add(E=>{},e=>{alias=>"E"});

Use string_cmp() to produce the answer checker(s) for your correct values. Eg.

        ANS(string_cmp("A","B"));

when there are two answers, the first being "A" and the second being "B".