Logic

End block and else branch on Logic

Ethereum
Ethereum
Base
Base
Control Flow

Ready to run on Base

Control flow is the oldest primitive in computing and the reason a program is more than a list of steps. Branching and looping are what separate a plan that reacts from a plan that merely fires, and every serious automation ever written, onchain or off, is built out of exactly these moves.

A plug takes one path when a condition holds and another when it does not. It repeats a body of work while something remains true, cuts the repetition short the moment it stops making sense, skips past a round that should not run, and closes each block cleanly so the structure of the plan is never ambiguous. The conditions are evaluated against live state at execution, not against what was true when the plan was written.

A ladder that keeps filling until the budget is spent or the price runs away. A strategy with a main path and a contingency that only exists when the main path fails its check. A loop that walks a position down in measured steps instead of one violent exit. The shape of the plan is the strategy, and the plans that perform are the ones with real structure, not a single hopeful transaction.

More plugs on Base

Dollar-cost average on Base · 4 plugs

How to end block and else branch on Logic

  • End block

    End block on Logic

    Ethereum
    Ethereum
    Base
    Base

    Closes the innermost open block, whether a conditional branch or a loop.

    Reach for it to mark where a branch or loop body stops and unconditional execution resumes, so the steps after it run on every path.

  • Opens the else branch of a conditional.

    Reach for it to give a decision two paths, such as supplying to market A when its rate wins and to market B otherwise, so exactly one path executes per run.

  • Exits the current loop immediately, continuing after the loop's end.

    Reach for it inside a loop behind a predicate, so a target reached mid-iteration, such as a balance depleted or a fill completed, stops the loop without waiting for its condition.

  • Skips the rest of the current loop iteration and re-evaluates the loop.

    Reach for it inside a loop behind a predicate to skip an item that fails a check, such as a market with no room, and move straight to the next iteration.

  • Opens a loop that repeats while a boolean, wired from an earlier step, stays true.

    Reach for it to repeat a step until a stored or computed flag flips, such as looping a borrow-swap-supply cycle while a comparison of health factor against a target still passes.

Posts · 18