11.3.8. Conditional Execution
11.3.8.1. Boolean Operators
Boolean operators evaluate to true
or false
, and are most useful in boolean expressions, where they help to determine which portion of a program to execute.
The following table lists binary boolean operators that take two arguments: one on the left and one on the right. These operators produce either
true
or
false
.
Table 11.1. Binary Boolean Operators in SuperCollider
Operator
|
Meaning
|
---|
<
|
less than
|
<=
|
less than or equal to
|
>
|
greater than
|
>=
|
greater than or equal to
|
==
|
equivalent
|
!=
|
not equivalent
|
===
|
identical (the same object)
|
!==
|
not identical (not the same object)
|
&&
|
logical And
|
||
|
logical Or
|
The following table lists unary boolean operators that take one arguments. These operators produce either
true
or
false
.
Table 11.2. Unary Boolean Operators in SuperCollider
Operator
|
Meaning
|
---|
isPositive
|
true if the argument is greater than or equal to 0
|
isStrictlyPositive
|
true if the argument is greater than 0
|
isNegative
|
true if isPositive is false
|
Unary operators are actually functions, and must be used as such.
(
var x = 5;
x.isPositive; // returns "true"
isNegative( x ); // returns "false"
)
The use of these operators is explained below in the "Boolean Expressions" section.