[LON-CAPA-users] sharing variables among questions

H. K. Ng lon-capa-users@mail.lon-capa.org
Fri, 04 Mar 2005 13:56:48 -0500

One way to do this is to define all the molecular mass in a library. So 
create a file, say,


In it put something like
<script type="loncapa/perl">
%masses =
     ( H20 => '18',
        O2 => '32'

Then to use the values in your problem, include a line

in your problem, if the lib is in the same directory as the problem. If not 
include the full path before the library name.

To use, say, the H20 mass in your problem use

- hk

At 01:30 PM 3/4/2005, you wrote:
>Is there a way to define variables that could be used in multiple 
>problems?  For example, let's say you want to use a set of molecular 
>masses in several problems.  Rather than copy the problems, is there a way 
>to define a variable @mass that could be stored, and then 'called' from 
>another specific problem?
>Dr. Sally S. Hunnicutt
>Assistant Chair, Associate Professor
>VCU Department of Chemistry
>1001 W. Main St.
>PO Box 842006
>Richmond VA 23284-2006
>LON-CAPA-users mailing list