File:  [LON-CAPA] / loncom / html / adm / help / tex / Variables_in_Scripts.tex
Revision 1.2: download - view: text, annotated - select for diffs
Thu Jul 18 15:52:27 2002 UTC (22 years ago) by bowersj2
Branches: MAIN
CVS tags: version_0_5_1, version_0_5, HEAD
Convenince labels added to the top of each file to assist in creating
index-type help files for things like the XML editor screen (where
there's nothing to hook help to).

    1: \label{Variables_in_Scripts}
    2: 
    3: Variables can be used later in the same script. For instance, we can add
    4: another line below the \texttt{\$variable} line as such:
    5: 
    6: \begin{lyxcode}
    7: \$variable2~=~\$variable~+~2;
    8: \end{lyxcode}
    9: 
   10: Now there is a variable called \texttt{\$variable2} with the the number {}``5''
   11: as its value. 
   12: 
   13: Variables can also be used in \emph{strings}\index{strings}, which are a
   14: sequence of letters. The underlying language of the script, Perl, has a very
   15: large number of ways of using variables in strings, but the easiest and most
   16: common way is to use normal double-quotes and just spell out the name of
   17: the variable you want to use in the string, like this:
   18: 
   19: \begin{lyxcode}
   20: \$stringVar~=~{}``I~have~a~variable~with~the~value~\$variable.''
   21: \end{lyxcode}
   22: 
   23: This will put the string {}``I have a variable with the value 3.'' into
   24: the variable named {}``stringVar''.

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>