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