Skip to main content

while

while loop

An expression is evaluated and as long as it is true, the block within the while statement will be executed.

Here is an example:

from std import *

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

at vcc
wire right 100

counter = 0
while counter < 5:
add led("yellow") pin 2
wire right 100
counter += 1

add res(10k)

wire right 100 down 100
to gnd
VCC12D1_1yellow12D1_2yellow12D1_3yellow12D1_4yellow12D1_5yellow12R110kGND