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
Available operators: Equal, Not Equal, Greater Than, Less Than, Greater or Equal, Less or Equal.
IF Node
The
- 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
Compare two values to produce a true or false result.
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
Wire the recipients list into the For Each loop.
Logic Gates
Logic gates combine true/false values to create more complex conditions. Like
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
What You Learned
compare nodes produce a true/false result from two valuesifCondition 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 orrequire nodes
How hard was this?