Decision Icon Properties

From Flowcode Help
Jump to navigationJump to search

<sidebar>Sidebar: Icon Properties</sidebar>

Btn Decision.gif Gen Decision Flowchart Icon.png Gen Decision Icon Properties.png

Decision icons allow you to test a condition and redirect the flow according to the outcome. Icons can be placed in either branch from the decision icon.


Display Name

The name of the icon that appears on the flowchart.


Condition

The decision box tests this condition to see which branch to continue down. If the condition evaluates to 0 or false then the 'No' branch is chosen. If the condition evaluates to a non zero number or true then the 'Yes' branch is chosen. Conditions can be made up from numbers, variables and operators:

See Calculation Icon Properties for a list of valid operators.


Numeric values can be in decimal (unmarked) or in HEX format (preceded by 0x) or in Binary format (preceded by 0b) e.g. 255 or 0xFF or 0b01010101.


Assuming that the variables have been previously defined, all the following are valid conditions.


DELAY = DELAY + 1

DELAY = (MYVAR + 3) * 3

NEXTBIT = LASTBIT >> 2 & MASK

AANDB = PORT_A AND PORT_B

INVX = NOT X


To test for two or more conditions, write tests for the individual conditions and combine them with logical operators.

When both conditions must be true: condition1 && condition2

When one condition being true suffices: condition1 || condition2


Assuming that the variables have been previously defined, all the following are valid conditions.

(DELAY = 1) && (X = 0)

(DELAY = 1) || (DELAY = 4)

(DELAY = 1) || ( (DELAY = 3) && (X = 0) )


Variables Arrow

Clicking on the down arrow brings up the variables dialog window allowing you to select an existing variable or to create a new one.


Swap Yes and No

Normally the 'Yes' path of execution goes off to the right of the decision icon and the 'No' path carries on down the flowchart. Select this option to swap the two branches around.


Boolean values

Flowcode treats zero as false and any non-zero value as true.

This allows the use of variables in a true or false context.

For example 'If TIMEUP' would execute the 'Yes' path if TIMEUP was non-zero.


Video instructions

See the Decision video to learn how to use the Decision icon effectively with other icons such as Input, Output and Delay icons.

{{#ev:youtube|iLT7rwsSL88|640}}