CltsSomeBool
This function checks whether at least one array element of a boolean array has the same value as the bTest function input parameter.
Namespace: Tc3_Collections
Library: Tc3_Collections (Tc3_Collections.compiled-library)
Syntax
FUNCTION CltsSomeBool : BOOL
VAR_INPUT
bTest: BOOL;
END_VAR
VAR_IN_OUT
in: ARRAY[*] OF BOOL;
END_VAR
VAR_OUTPUT
index: DINT;
END_VAR
Inputs
Name | Type | Description |
---|---|---|
bTest | BOOL | Test value that is compared with all array elements. |
Inputs/outputs
Name | Type | Description |
---|---|---|
in | ARRAY[*] OF BOOL | The boolean array variable to check. |
Outputs
Name | Type | Description |
---|---|---|
index | DINT | Index of the first array element whose value is equal to the bTest function input parameter. This value is 0 if the function return value is "FALSE". |
Return value
Name | Type | Description |
---|---|---|
CltsSomeBool | BOOL | "TRUE" if at least one array element has the same value as the bTest function input parameter. "FALSE" if none of the array elements has the same value as the bTest function input parameter. |
Sample
PROGRAM MAIN
VAR
a: ARRAY[1..5] OF BOOL;
index: DINT;
bResult: BOOL;
END_VAR
a[1]:=FALSE;
a[2]:=FALSE;
a[3]:=FALSE;
a[4]:=FALSE;
a[5]:=FALSE;
bResult:=CltsSomeBool(bTest:=TRUE, in:=a, index=>index);(* return value is FALSE, index = 0 *)
a[1]:=FALSE;
a[2]:=FALSE;
a[3]:=TRUE;
a[4]:=FALSE;
a[5]:=TRUE;
bResult:=CltsSomeBool(bTest:=TRUE, in:=a, index=>index);(* return value is TRUE, index = 3 *)
bResult:=CltsSomeBool(bTest:=FALSE, in:=a, index=>index);(* return value is TRUE, index = 1 *)