Referenceboolean

<boolean>

A boolean value

<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.

includeErrorInNumberExponents

boolean. 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.

numPeriodicSetMatchesRequired

integer. Default value: 3. Number of consecutive elements of a periodic set required to count as a match.

numSignErrorsMatched

number. Default value: 0. Maximum number of sign errors that still count as a match.

keyword. Level of simplification applied to math expressions before comparing.

ValueDescription
none (default)No simplification is applied before comparing.
fullFully simplify both expressions before comparing.
numbersSimplify numeric subexpressions only, leaving symbolic structure intact.
numbersPreserveOrderLike numbers, but does not reorder commutative operands.
normalizeOrderReorder 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)
copy

reference. Create an independent copy of another component by reference. Enter a references a $name.

disabled

boolean. Default value: false. Whether this component is disabled and cannot be interacted with.

extend

reference. Extend another component by reference, inheriting its children and attributes. Enter a reference as $name.

fixed

boolean. Default value: false. Whether this component's value is fixed and cannot be modified.

fixLocation

boolean. Default value: false. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).

hide

boolean. Default value: false. Whether to hide this component from the rendered output.

isResponse

boolean. Default value: false. Whether this component is treated as a response for the purposes of assessment.

name

text. The name used to reference this component from elsewhere in the document.

styleNumber

integer. 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.allowedErrorInNumbers

number. Maximum allowed numeric error when comparing numbers.

$b.allowedErrorIsAbsolute

boolean. Whether allowedErrorInNumbers is interpreted as an absolute (rather than relative) tolerance.

$b.caseInsensitiveMatch

boolean. Whether text comparisons ignore letter case.

$b.disabled

boolean. Whether this component is disabled and cannot be interacted with.

$b.expandOnCompare

boolean. Whether to expand math expressions before comparing.

$b.fixed

boolean. Whether this component's value is fixed and cannot be modified.

$b.fixLocation

boolean. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).

$b.hidden

boolean. Whether this component is hidden from the rendered output.

$b.includeErrorInNumberExponents

boolean. Whether the allowed numeric error also applies to numbers in exponents.

$b.matchBlanks

boolean. Whether unfilled blanks in a math expression count as a match.

$b.matchByExactPositions

boolean. Whether to match list values by exact position rather than by content.

$b.numPeriodicSetMatchesRequired

integer. Number of consecutive elements of a periodic set required to count as a match.

$b.numSignErrorsMatched

number. Maximum number of sign errors that still count as a match.

$b.simplifyOnCompare

text. Level of simplification applied to math expressions before comparing.

$b.symbolicEquality

boolean. Whether children compared via this boolean use symbolic equality.

$b.text

text. The boolean rendered as a text string ("true" or "false").

$b.unorderedCompare

boolean. Whether order is ignored when comparing list-like values.

boolean. The boolean value (true or false).

Common to all components (4)
$b.doenetML

text. The DoenetML source code that produced this component.

$b.hide

boolean. Whether to hide this component from the rendered output.

$b.isResponse

boolean. Whether this component is treated as a response for the purposes of assessment.

$b.styleNumber

integer. 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.