Control Flow

Control flow lets your contract make decisions instead of running every step in a straight line. With conditions and branches, your logic can react differently depending on the data it receives.

Compare Node

The compare node takes two values and an operator, then produces a true or false result. It has no triangle connectors because it only computes data; it doesn’t perform an action.

Available operators: Equal, Not Equal, Greater Than, Less Than, Greater or Equal, Less or Equal.

IF Node

The ifCondition node reads a true or false value and splits execution into two paths:

  • Then: runs when the condition is true
  • Otherwise: runs when the condition is false
  • Done: runs after either branch finishes

Think of it like a fork in the road: you go left or right depending on the sign, but both paths eventually merge back onto the same highway. The Done handle is where the road merges. Connect any steps that should happen regardless of which branch was taken to the Done triangle.

Try It Yourself

Task 1 of 3 Build a Condition

Compare two values to produce a true or false result.

1 Type Value A
2 Type Value B
3 Wire the result
4 Done!
Type 100 in the Value A field.
Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

Loops

Loops repeat a set of steps multiple times. Doodledapp supports three loop types:

  • For: repeats a fixed number of times using a counter
  • While: repeats as long as a condition stays true
  • For Each: repeats once for every item in a list

Each loop has a Body triangle (the steps that repeat) and an Exit triangle (where execution continues after the loop finishes).

Try It Yourself

Task 1 of 2 Connect the Array

Wire the recipients list into the For Each loop.

1 Wire the array
2 Done!
Drag from the output circle on the recipients variable to the Array circle on the Loop node.
Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

Logic Gates

Logic gates combine true/false values to create more complex conditions. Like compare, they are data-only nodes with no triangle connectors: they produce a result, but don’t perform an action.

AND

The AND node takes two inputs (A and B) and outputs true only when both are true. Think of a safe that requires both a key and a passcode: you need both to open it.

OR

The OR node takes two inputs and outputs true when either one is true. Think of a door that opens with a keycard or a fingerprint: either one works.

NOT

The NOT node takes one input and outputs the opposite. If the input is true, the output is false, and vice versa. Think of a light switch: flip it and the state reverses.

Combining Gates

Wire the output of any gate into another gate, an ifCondition condition, or a require node to build layered logic. For example: wire two compare outputs into an AND, then wire the AND output into an ifCondition condition. The ifCondition only follows “Then” when both comparisons are true.

What You Learned

  • compare nodes produce a true/false result from two values
  • ifCondition nodes split the flow into two paths based on that result, with a Done handle for steps that run after either branch
  • Loops repeat steps using For, While, or For Each
  • AND outputs true only when both inputs are true
  • OR outputs true when either input is true
  • NOT flips a true/false value to its opposite
  • Logic gates are data-only and can be combined with each other and with ifCondition or require nodes