Difference between revisions of "Sage in WeBWorK"

From WeBWorK_wiki
Jump to navigation Jump to search
(Created page with ' you can pass perl variables to the sage block if you need to from the problem initialization aubreyja_is that what you were trying to do? aubreyja_In that case, just do TEX…')
 
Line 2: Line 2:
   
   
  +
To pass perl variables to the sage block if you need to from the problem initialization use:
   
you can pass perl variables to the sage block if you need to from the problem initialization
 
  +
:: TEXT(<<EOF);
   
aubreyja_is that what you were trying to do?
 
  +
where <<EOF allows interpolation
   
aubreyja_In that case, just do TEXT(<<EOF);
 
  +
otherwise use:
   
aubreyja_not TEXT(<<'EOF');
+
:: TEXT(<<'EOF');
   
JohnTravisWhat's the functional difference?
 
  +
where 'EOF' tells perl not to interpolate variables
 
aubreyja_and make sure that the variables you want interpolated are defined above the sage block
 
 
JohnTravis'EOF' vs just EOF?
 
 
aubreyja_'EOF' tells perl not to interpolate variables, but <<EOF allows interpolation
 
   
 
15:17aubreyja_yes
 
15:17aubreyja_yes

Revision as of 16:20, 30 December 2011


To pass perl variables to the sage block if you need to from the problem initialization use:

TEXT(<<EOF);

where <<EOF allows interpolation

otherwise use:

TEXT(<<'EOF');

where 'EOF' tells perl not to interpolate variables

15:17aubreyja_yes