# The Algorithm field

The most important section for writing an exercise with WIRIS quizzes is the Algorithm field, consisting of a WIRIS cas section. This field is common to all types of question improved by WIRIS, since it includes the whole mathematical functionality of the exercise.

The WIRIS cas session is a Java applet that will run when viewing the question. In it, the teacher can define variables with numeric, symbolic or graphic values. They can be random variables, the result of complex calculations, and also function graphs or geometric constructions. All variables here defined can be used, afterwards, anywhere in the exercise: in the wording, correct or wrong answers, and student feedback.

WIRIS cas session is divided in two areas: the menuº and the work session. The menu helps us in the intuitive introduction of formulas and commands. The menu does not contain all operations and functions supported by WIRIS cas, but the most frequent. For more information on the WIRIS programming language and its capacities, check the WIRIS cas manual.

Work session is also divided in two areas: the library, the area surrounded by a yellow box, and the area next to it, formed by calculation blocks. We will access this area with the key combination Control+Enter or with the  button.

In the library we must define all variables required for the question. The library does not display the result of the operations, since it is aimed at defining, not calculating. In order to verify that there is no mistake in the calculations of the library, there are two calculation blocks beside it, which are also thrown with the key combination Control+Enter or with the  button.

Do not forget that all definitions developed outside the library will be omitted when a student views the question; this space must only be used for tests and verifications.

The variables defined in the algorithm can be used in almost every text field in the question edit form. To state it, the variable name is preceded by the # sign (hash). In the text of the question, the feedback or the answer fields (depending on the type of question), HTML or text can be mixed with the references to variables. For example, the wording of the question corresponding to the algorithm on the previous figure could be:

When viewing the question, the references to variables will be replaced with their value and will display correctly as an image.

The Algorithm field can be translated into other languages with a single click as described in the following section.