WeBWorK Problems

How to use variables/tex codes in solutions

Re: How to use variables/tex codes in solutions

by Dick Lane -
Number of replies: 0
a,b,c are integers for the following snippet.


@EO = ( 'Even' , 'Odd' ) ;
$ap = @EO[ $a % 2 ] ;
$cp = ($c % 2 == 0) ? 'Even' : 'Odd' ;

Context()->texStrings;
BEGIN_SOLUTION
$SOLUTION
\( $a \) is $ap,
        $b is @EO[$b % 2],
        \( $c \) is $cp
END_SOLUTION
Context()->normalStrings;


Note: neither "Context()" command is commented-out, the new BEGIN_SOLUTION is used to initiate the block, and $SOLUTION to display bolded "Solution:".