loop有吧 . P& M: `' {/ \ X% E- @) ]6 aloop$ n+ V6 J* Q* K3 k5 _8 g9 p# D. ]
loop [ commands ] 0 k# M4 T7 m' K- QRuns the list of commands forever, or until the current procedure exits through use of the stop / x0 D, K# _2 _" C% k+ H5 kcommand or the report command. + c3 A) }2 Q; A; O) j; C; TNote: In most circumstances, you should use a forever button in order to repeat something forever. 3 D5 g; F% Y# C* G9 E# xThe advantage of using a forever button is that the user can click the button to stop the loop ! R+ k' y7 _# u5 c \" f, Z0 f 4 H- H/ D0 ^0 f; j$ B(version 3.1.3) ' I6 v$ `1 G4 R' Q不过好像不大推荐
globals[p ml ]/ B2 W2 _) F/ N3 |5 Q
to setup8 P6 ] D. k7 X
set ml n-values 200 [ifelse-value (random-float 1 < 0.3 ) [0] [1] ]7 w4 b- q- ^8 l4 X9 `9 v
set ml filter [ ? = 1] ml6 O; a5 X A" B+ V: F3 G+ r- y3 X2 Y3 Y
set p 1$ K; f1 J7 H- m
repeat length ml [ set p p + 1]% X4 F) H2 Z9 b3 B! W. q/ _" b
if p > 100[stop] " f3 l. C# P |show p 1 N3 |& u% s4 b- }1 C3 N- I
end7 k. _. H; z3 ]3 _! n' M