functionallTrue

Returns true, if Boolean input vector is non-empty and all elements are true ('and')

Extends from Modelica.Icons.Function (Icon for functions).

Information

Syntax

allTrue(b);

Description

Returns true if all elements of the Boolean input vector b are true. Otherwise the function returns false. If b is an empty vector, i.e., size(b,1)=0, the function returns false (as opposed to andTrue returning true).

Example

  Boolean b1[3] = {true, true, true};
  Boolean b2[3] = {false, true, false};
  Boolean r1, r2;
algorithm
  r1 = allTrue(b1);  // r1 = true
  r2 = allTrue(b2);  // r2 = false

See also

andTrue, anyTrue, countTrue, enumerate, firstTrueIndex, index, and oneTrue.

Inputs

TypeNameDefaultDescription
Boolean[:]bBoolean vector

Outputs

TypeNameDefaultDescription
Booleanresultsize(b, 1) > 0 and min(b)= true, if all elements of b are true