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
line 6:1VCCComponent D1_1: line 11:512D1_1yellowComponent D1_2: line 11:512D1_2yellowComponent D1_3: line 11:512D1_3yellowComponent D1_4: line 11:512D1_4yellowComponent D1_5: line 11:512D1_5yellowComponent R1: line 15:1R110kline 18:4GND