File:  [LON-CAPA] / loncom / html / adm / help / tex / Numerical_Response_Simple_Example.tex
Revision 1.5: download - view: text, annotated - select for diffs
Mon Sep 9 20:47:45 2013 UTC (10 years, 9 months ago) by raeburn
Branches: MAIN
CVS tags: version_2_12_X, version_2_11_X, 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
- Remove unwanted characters from verbatim block.

\label{Numerical_Response_Simple_Example}

A script consists of several \textbf{statements}, separated by \textbf{semi-colons}.
A \textbf{statement\index{statement}} is the smallest kind of instruction
to the computer. Most problems will be built from several statements. 

A script can contain \textbf{comments}, which are not interpreted as statements
by the computer. Comments start with \textbf{\#} and go to the end of that
line. Thus, if a line starts with \#, the whole line is ignored. Comments
can also begin in the middle of a line. It is a good idea to comment more
complicated scripts, as it can be very difficult to read a large script and
figure out what it does. It is a \emph{very} good idea to adopt some sort
of commenting standard, especially if you are working in a group or you believe
other people may use your problems in the future.

\begin{itemize}
\item One of the simplest statements in LON-CAPA is a \textbf{variable assignment}.
A \textbf{variable} can hold any value in it. The variable name must start
with a \textbf{\$}. In the \textbf{Script}, you need to assign to variables
before you use them. Put this program into the \textbf{Script} field of the
Numerical Response:

\begin{verbatim}
$variable = 3;
\end{verbatim}
This creates a variable named \textbf{variable} and assigns it the value
of {}``3''. That's one statement.

\end{itemize}
Variable names are \emph{case sensitive}, must start with a letter, and can
only consist of letters, numbers, and underscores. Variable names can be
as long as you want.

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