# Part 7: Interval¶

Consider the case that the answer to a problem is an interval.

The syntax is similar to the one for sets

The solution is defined by a left boundary ([ for closed and ] for open), two semicolon separated numbers or variables, and a right boundary (] for closed or [ for open)

Here is an example

\begin{problem} \begin{question} \text{Write down the Interval from 1 to 3:} \explanation{Test test Test} \type{input.interval} \field{rational} \begin{answer} \text{ A = } \solution{[1;3]} % or ] for open type, the boundaries should be separated by ";" \end{answer} \end{question} \end{problem}

There is the optional TeX command `\allowIntervalUnionsForInput[<boolean, default: true>]`

with which you can enable

the option that the student's answer can be given by the union of multiple intervals.

\begin{answer} \text{input.interval: $[1;4) = $} \allowIntervalUnionsForInput \solution{[1;4)} \end{answer}

Furthermore as an author you can give the correct solution as an union of multiple disjoint intervals by seperating them with a comma, an example:

\solution{(-infinity;2],[3;infinity)}

Be aware that this is only possible if the optional command

`\allowIntervalUnionsForInput`

is used.