Skip to main content

break

break

When this is used within a loop (while or for), it will stop further execution of the loop.

Example:

import lib

vcc = supply("VCC")
gnd = dgnd()

at vcc
wire right 100

counter = 0

# Loop through an array of colors
while true:
add led("yellow")
wire right 100
counter += 1

# once this condition is reached, then stop the loop
if counter > 4:
break

add res(10k)

wire right 100 down 100
to gnd

VCC12D1yellow12D2yellow12D3yellow12D4yellow12D5yellow12R110kGND

break within circuit paths

If break is used within a branch command, it will stop further execution within that branch and return to the original branch location.