File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change 3030 }
3131 )
3232 ~~~
33+
34+ Because repeat parses each step each time, repeat is likely to be one of the slower ways to repeat.
3335. EXAMPLE
3436 turtle repeat 3 [rotate (360/3) forward 42] save ./tri.svg
3537. EXAMPLE
5052 ) forward 4.2]]] save ./r3.svg
5153#>
5254param (
53- # The repeat count. This will be rounded down to the nearest integer.
55+ # The repeat count.
56+ # This will be rounded down to the nearest integer and converted into an absolute value.
5457[double ]
5558$RepeatCount ,
5659
@@ -64,9 +67,7 @@ $Command
6467if (-not $RepeatCount ) { return $this }
6568$floorCount = [Math ]::Abs([Math ]::Floor($RepeatCount ))
6669
67- if ($floorCount -ge 1 ) {
68- foreach ($repetition in 1 .. $floorCount ) {
69- $this = $this | turtle @command
70- }
70+ if ($floorCount -ge 1 ) {
71+ $this = $this | turtle @ ($Command * $floorCount )
7172}
7273return $this
You can’t perform that action at this time.
0 commit comments