<boolean>
<boolean> is a Logic
component that renders the boolean value of true or false of the enclosed expression.
Attributes and Properties
Attributes for <boolean>
Other (12)
number. Default value: 0. Maximum allowed numeric error when comparing numbers.
boolean. Default value: false. Whether allowedErrorInNumbers is interpreted as an absolute (rather than relative) tolerance.
boolean. Default value: false. Whether text comparisons ignore letter case.
boolean. 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.
boolean. Default value: false. Whether unfilled blanks in a math expression count as a match.
boolean. Default value: false. Whether to match list values by exact position rather than by content.
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.
keyword. 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. |
boolean. Default value: false. Whether children compared via this boolean use symbolic equality.
boolean. 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 <boolean name="b">
Other (18)
$b.allowedErrorInNumbersnumber. Maximum allowed numeric error when comparing numbers.
$b.allowedErrorIsAbsoluteboolean. Whether allowedErrorInNumbers is interpreted as an absolute (rather than relative) tolerance.
$b.caseInsensitiveMatchboolean. Whether text comparisons ignore letter case.
$b.disabledboolean. Whether this component is disabled and cannot be interacted with.
$b.expandOnCompareboolean. Whether to expand math expressions before comparing.
$b.fixedboolean. Whether this component's value is fixed and cannot be modified.
$b.fixLocationboolean. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).
$b.includeErrorInNumberExponentsboolean. Whether the allowed numeric error also applies to numbers in exponents.
$b.matchBlanksboolean. Whether unfilled blanks in a math expression count as a match.
$b.matchByExactPositionsboolean. Whether to match list values by exact position rather than by content.
$b.numPeriodicSetMatchesRequiredinteger. Number of consecutive elements of a periodic set required to count as a match.
$b.numSignErrorsMatchednumber. Maximum number of sign errors that still count as a match.
$b.simplifyOnComparetext. Level of simplification applied to math expressions before comparing.
$b.symbolicEqualityboolean. Whether children compared via this boolean use symbolic equality.
$b.texttext. The boolean rendered as a text string ("true" or "false").
$b.unorderedCompareboolean. Whether order is ignored when comparing list-like values.
$b.valueboolean. The boolean value (true or false).
Common to all components (4)
$b.doenetMLtext. The DoenetML source code that produced this component.
$b.hideboolean. Whether to hide this component from the rendered output.
$b.isResponseboolean. Whether this component is treated as a response for the purposes of assessment.
$b.styleNumberinteger. The style number used to select this component's visual styling from the available style definitions.
Examples
Example: <boolean> value of an equation
A <boolean> component is used to render whether an
equation is true or false for a user-supplied response
Example: <boolean> value of a geometric property
A <boolean> component is used to render whether a statement regarding
the geometric slope of a named <line> is true or false. Adjust the slope of
the line to affect the <boolean>.
Example: Constructing compound <boolean> expressions
Multiple named <boolean> components can be combined to create
more complex boolean expressions.
Attribute Examples
Attribute Example: symbolicEquality
Comparing two values with the symbolicEquality attribute demands exact syntactical equality.
Attribute Example: expandOnCompare
Comparing two values with the expandOnCompare and symbolicEquality attributes
allows expressions that are equivalent after expanding to evaluate to true.
Attribute Example: simplifyOnCompare
Comparing two values with the simplifyOnCompare and symbolicEquality attributes
allows expressions that are equivalent after simplifying to evaluate to true.
Attribute Example: unorderedCompare
When multiple values are compared within a single <boolean> tag,
the default behavior is to match the order of the sequenced values.
If order is irrelevant, use the unorderedCompare attribute.
Attribute Example: matchByExactPositions
When multiple responses are evaluated by comparison with a
vector of correct values inside a <boolean>, the matchByExactPositions attribute
enforces a strict order onto the validation. Only correct values in the correct answer
blanks will allow the <boolean> to evaluate to true.
Attribute Example: allowedErrorInNumbers
The allowedErrorInNumbers attribute may be used to specify the
acceptable error of an approximate response when comparing numerical values.
By default, the error is specified as a fractional value.
Attribute Example: allowedErrorIsAbsolute
To specify an allowed error with a specific numerical
value (rather than as a fraction of the correct response), use
the allowedErrorIsAbsolute attribute in combination
with the allowedErrorInNumbers attribute.
Attribute Example: caseInsensitiveMatch
Use the caseInsensitiveMatch attribute if capitalization is not relevant for comparison.
Attribute Example: matchBlanks
Use the matchBlanks attribute to accurately compare two expressions containing blanks.
Property Examples
Property Example: value
The value property of a named <boolean> returns its value of true or false.
Property Example: text
The text property of a named <boolean> returns the text value of true or false.
Property Example: Attributes as properties 1
The above listed attributes of a <boolean> are also available as properties.
Property Example: Attributes as properties 2
The above listed attributes of a <boolean> are also available as properties.