<when>
<when> is an Evaluation
component that is used for creating boolean conditions within an <award>.
Attributes and Properties
Attributes for <when>
Other (13)
allowedErrorInNumbersnumber. Default value: 0. Maximum allowed numeric error when comparing numbers.
allowedErrorIsAbsoluteboolean. Default value: false. Whether allowedErrorInNumbers is interpreted as an absolute (rather than relative) tolerance.
caseInsensitiveMatchboolean. Default value: false. Whether text comparisons ignore letter case.
expandOnCompareboolean. Default value: false. Whether to expand math expressions before comparing.
includeErrorInNumberExponentsboolean. Default value: false. Whether the allowed numeric error also applies to numbers in exponents.
matchBlanksboolean. Default value: false. Whether unfilled blanks in a math expression count as a match.
matchByExactPositionsboolean. Default value: false. Whether to match list values by exact position rather than by content.
boolean. Default value: false. Whether to match partial conditions for partial credit.
numPeriodicSetMatchesRequiredinteger. Default value: 3. Number of consecutive elements of a periodic set required to count as a match.
numSignErrorsMatchednumber. Default value: 0. Maximum number of sign errors that still count as a match.
simplifyOnComparekeyword. Level of simplification applied to math expressions before comparing.
| Value | Description |
|---|---|
none (default) | No simplification is applied before comparing. |
full | Fully simplify both expressions before comparing. |
numbers | Simplify numeric subexpressions only, leaving symbolic structure intact. |
numbersPreserveOrder | Like numbers, but does not reorder commutative operands. |
normalizeOrder | Reorder commutative operands into a canonical form without simplifying values. |
symbolicEqualityboolean. Default value: false. Whether children compared via this boolean use symbolic equality.
unorderedCompareboolean. Default value: false. Whether order is ignored when comparing list-like values.
Common to all components (9)
copyreference. Create an independent copy of another component by reference. Enter a references a $name.
disabledboolean. Default value: false. Whether this component is disabled and cannot be interacted with.
extendreference. Extend another component by reference, inheriting its children and attributes. Enter a reference as $name.
fixedboolean. Default value: false. Whether this component's value is fixed and cannot be modified.
fixLocationboolean. Default value: false. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).
hideboolean. Default value: false. Whether to hide this component from the rendered output.
isResponseboolean. Default value: false. Whether this component is treated as a response for the purposes of assessment.
nametext. The name used to reference this component from elsewhere in the document.
styleNumberinteger. Default value: 1. The style number used to select this component's visual styling from the available style definitions.
Properties for <when name="w">
Other (21)
$w.allowedErrorInNumbersnumber. Maximum allowed numeric error when comparing numbers.
$w.allowedErrorIsAbsoluteboolean. Whether allowedErrorInNumbers is interpreted as an absolute (rather than relative) tolerance.
$w.caseInsensitiveMatchboolean. Whether text comparisons ignore letter case.
boolean. Whether the condition is currently satisfied; equivalent to value.
$w.disabledboolean. Whether this component is disabled and cannot be interacted with.
$w.expandOnCompareboolean. Whether to expand math expressions before comparing.
$w.fixedboolean. Whether this component's value is fixed and cannot be modified.
$w.fixLocationboolean. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).
number. Fraction of the boolean condition that is satisfied (0 to 1).
$w.includeErrorInNumberExponentsboolean. Whether the allowed numeric error also applies to numbers in exponents.
$w.matchBlanksboolean. Whether unfilled blanks in a math expression count as a match.
$w.matchByExactPositionsboolean. Whether to match list values by exact position rather than by content.
$w.matchPartialboolean. Whether to match partial conditions for partial credit.
$w.numPeriodicSetMatchesRequiredinteger. Number of consecutive elements of a periodic set required to count as a match.
$w.numSignErrorsMatchednumber. Maximum number of sign errors that still count as a match.
$w.simplifyOnComparetext. Level of simplification applied to math expressions before comparing.
$w.symbolicEqualityboolean. Whether children compared via this boolean use symbolic equality.
$w.texttext. The boolean rendered as a text string ("true" or "false").
$w.unorderedCompareboolean. Whether order is ignored when comparing list-like values.
$w.valueboolean. Whether the condition is currently true.
Common to all components (4)
$w.doenetMLtext. The DoenetML source code that produced this component.
$w.hideboolean. Whether to hide this component from the rendered output.
$w.isResponseboolean. Whether this component is treated as a response for the purposes of assessment.
$w.styleNumberinteger. The style number used to select this component's visual styling from the available style definitions.
Examples
Example: <when> in an <award> with <mathInput/>
<when> is used to specify the boolean condition within an <award>.
Example: <when> in an <award> with graphical input
<when> is used to specify the boolean condition within an <award>. In
this case, the boolean is based on graphical interactions performed by the user to update the radius of the named <circle/>.
Example: <when> in an <award> with <textInput/>
<when> is used to specify the boolean condition within an <award>. In
this case, the boolean is based on the value of a <textInput/>.
Attribute Examples
Attribute Example: matchPartial
The matchPartial attribute signifies that partial credit is to be awarded if any part of the
enclosed boolean condition is true.
Property Examples
Property Example: value
The value property renders the value of the boolean condition enclosed by the <when> component.
Property Example: fractionSatisfied
The fractionSatisfied property renders the fractional value corresponding to
which portion of the boolean condition enclosed by the <when> evaluates to true.
Property Example: conditionSatisfied
The conditionSatisfied property renders the boolean value corresponding to
whether the <when> condition has been satisfied.
Property Example: matchPartial
The matchPartial attribute of the <when> component is also accessible as a property.