File:
[LON-CAPA] /
loncom /
html /
adm /
help /
tex /
Variables_in_Scripts.tex
Revision
1.5:
download - view:
text,
annotated -
select for diffs
Mon Sep 2 23:23:42 2013 UTC (10 years, 11 months ago) by
raeburn
Branches:
MAIN
CVS tags:
version_2_12_X,
version_2_11_X,
version_2_11_5_msu,
version_2_11_5,
version_2_11_4_uiuc,
version_2_11_4_msu,
version_2_11_4,
version_2_11_3_uiuc,
version_2_11_3_msu,
version_2_11_3,
version_2_11_2_uiuc,
version_2_11_2_msu,
version_2_11_2_educog,
version_2_11_2,
version_2_11_1,
version_2_11_0_RC3,
version_2_11_0_RC2,
version_2_11_0,
HEAD
- perl code previously included within lyxcode begin/end within verbatim
begin/end instead.
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{verbatim}
7: $variable2 = $variable+2;
8: \end{verbatim}
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{verbatim}
20: $stringVar = "I have a variable with the value $variable.";
21: \end{verbatim}
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>