.Modelica.Math.BooleanVectors.anyTrue

Information

Syntax

anyTrue(b);

Description

Returns true if at least one element of the input Boolean vector b is true. Otherwise the function returns false. If b is an empty vector, i.e., size(b,1)=0, the function returns false.

Example

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

See also

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

Interface

function anyTrue
  extends Modelica.Icons.Function;
  input Boolean b[:] "Boolean vector";
  output Boolean result "= true, if at least one element of b is true";
end anyTrue;

Generated at 2024-04-28T18:16:21Z by OpenModelicaOpenModelica 1.22.3 using GenerateDoc.mos