dglux5_wiki:dataflow:dataflow_blocks_reference:logic:if

Action unknown: siteexport_addpage

If

Block Group: Logic
Icon:If block icon

The If block returns one value if a condition that you specify evaluates to TRUE and another value if the condition evaluates to FALSE.

For information on using dataflow blocks, see Dataflow.


The following properties of the If block can take input and give output.

  • op (enum)
  • input n
  • then
  • else

op specifies the comparison, logical, or text operator to apply to the input values. It is used in conjunction with input n to form an expression that can be evaluated to TRUE or FALSE. The default is "=". The value of the op property can be one of the following:

  • = (equal to) – The expression evaluates to TRUE if all input values are equal.
  • > (greater than) – The expression evaluates to TRUE if each input value is greater than the value that immediately follows it.
  • < (less than) – The expression evaluates to TRUE if each input value is less than the value that immediately follows it.
  • >= (greater than or equal to) – The expression evaluates to TRUE if each input value is greater than or equal to the value that immediately follows it.
  • ⇐ (less than or equal to) – The expression evaluates to TRUE if each input value is less than or equal to the value that immediately follows it.
  • != (not equal to) – The expression evaluates to TRUE if no other input value is equal to input 0. (Each input is compared only with input 0, not with each other.)
  • and – The expression evaluates to TRUE if all input values evaluate to TRUE. See also: And block.
  • or – The expression evaluates to TRUE if one or more input values evaluate to TRUE. See also: Or block.
  • contains – The expression evaluates to TRUE if input 0, as a string, contains at least one of the other input values.
  • startsWith – The expression evaluates to TRUE if input 0, as a string, starts with at least one of the other input values.
  • endsWith – The expression evaluates to TRUE if input 0, as a string, ends with at least one of the other input values.

input n specifies two or more values to be evaluated using the operator specified. The block has two inputs by default; click the plus sign to add more. A newly added input is 0 by default (TRUE when op is "and", FALSE when op is "or"). If the block has fewer than two inputs, the output is not updated.

then specifies the value to return if the expression evaluates to TRUE.

else specifies the value to return if the expression evaluates to FALSE.


The following property of the If block can give output but cannot take input.

  • output (number, string or boolean)

output returns either the then value or the else value. The then value is returned if the expression evaluates to TRUE, and the else value is returned otherwise.


The following image demonstrates two examples of the If block. In this image, the leftmost If block returns “Within Budget” if the bound value is less than 100 and returns “Over Budget” otherwise. The rightmost If block returns twice the value of input 0 if input 0 is less than 100 and returns 100 otherwise.

If dataflow model


  • dglux5_wiki/dataflow/dataflow_blocks_reference/logic/if.txt
  • Last modified: 2026/10/22 13:24
  • by 127.0.0.1