branch
branch
The branch
command allows the circuit to split off from a given insertion point. After all branch
blocks are executed, the pre-branch insertion point is restored.
What happens within a branch block is indicated by an indent.
Example:
import lib
v5v = supply("5V")
gnd = dgnd()
at v5v
wire down 100 # Point A
branch:
wire down 100 # Wire is added within this branch.
add res(20k)
wire down 200
to gnd
wire right 300 down 200 # Wire is added after point A
add cap(100n)
wire down 100
to gnd
In the above example, the branch
splits off to create the path with the res(20k)
. When this path in this branch
block has completed execution, the insertion point is reset back to the the pre-branching state. In this case, it is after the wire down 20
from v5v
.
Consecutive branch blocks will share the same branching point.
warning
It is possible to have branches within branches, but bear in mind that readability might be affected.