Annotation of loncom/html/adm/help/tex/Calling_Functions.tex, revision 1.1
1.1 ! bowersj2 1:
! 2: With variables, you can store strings or numbers. \textbf{Functions} allow
! 3: you to manipulate these strings or numbers. Functions work like mathematical
! 4: functions: They take some number of arguments in, and return one argument,
! 5: usually a number or a string for our purposes. There are a lot of functions
! 6: available in LON-CAPA. You can see a complete list at http://mileva.lite.msu.edu/loncapadocs/homework/homework5.html.
! 7: For now, let's just look at some simple examples.
! 8:
! 9: %
! 10: \begin{figure}
! 11: \begin{lyxcode}
! 12: \$a~=~-3.0;
! 13:
! 14: \$b~=~\&sin(\$a);
! 15:
! 16: \$c~=~\&pow(3.0,~\&abs(\$a));
! 17: \end{lyxcode}
! 18:
! 19: \caption{Some Function Calls\label{Some Function Calls Figure}}
! 20: \end{figure}
! 21: In the \textbf{Script} block, function names start with \textbf{\&}. Some
! 22: example function calls are shown in figure \ref{Some Function Calls Figure}.
! 23: You can see that functions can take either variables, numbers, or the results
! 24: of other function calls as parameters. The \texttt{\&sin} function returns
! 25: the sine of an angle expressed in radians. \texttt{\&pow} raises the first
! 26: parameter to the power of the second parameter. \texttt{\&abs} returns the
! 27: absolute value of the argument.
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>