Index

Working with MUMIE as author

Working with MUMIE as teacher

Using MUMIE via plugin in local LMS

Overview

Go back to the old wiki

We revise and update this wiki. We apologize for the inconvenience this may cause you.

# Switch Case Statement

Use a switch/case statement to make sure your variables satisfy specific constraints

1234567891011121314151617\begin{switch}   \begin{case}{<condition 1>}    <variable definitions>  \end{case}   \begin{case}{<condition 2>}    <variable definitions>  \end{case}   ...   \begin{default}    <variable definitions>  \end{default} \end{switch} 

Every variable in a switch environment must have a default definition, but not a definition for every
single case environment. (see example below)

There is no limitation on how many case environments you can use inside a switch environment. The default
environment though is obligatory!

You can use switch/case statements globally and on question level.

Never use switch/case statements in combination with \randadjustIf. It is meant as an alternative.

Example

1234567891011121314151617181920212223242526272829303132\begin{variables}  \randint{a}{1}{5}  \function{f0}{10*a}   \begin{switch}    \begin{case}{a>3}      \number{c}{3}      \randrat{d}{1}{2}{3}{7}      \drawFromSet{m}{1,2,3}      \function{f}{2*a}      \derivative{g}{3x^2+sqrt(x)}{x}      \substitute{h}{sqrt(y)}{y}{g}      \string{s}{case 1}    \end{case}     \begin{case}{a=3}      \number{c}{5}    \end{case}     \begin{default}      \randint{c}{1}{10}      \randrat{d}{-2}{-1}{3}{7}      \drawFromSet{m}{-1,-2,-3}      \function{f}{-2*a}               \derivative{g}{-3x^2+sqrt(x)}{x}         \substitute{h}{sqrt(y)}{y}{g}      \string{s}{default case}    \end{default}   \end{switch} \end{variables}