Skip to content

Commit a05d068

Browse files
feat: Turtle.Pop() ( Fixes #92 )
1 parent 324201f commit a05d068

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Types/Turtle/Pop.ps1

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
if ($this.'.Stack' -isnot [Collections.Stack]) {
2+
return
3+
}
4+
5+
if ($this.'.Stack'.Count -eq 0) {
6+
return
7+
}
8+
9+
$popped = $this.'.Stack'.Pop()
10+
$this.PenUp().Goto($popped.Position.X, $popped.Position.Y).PenDown()
11+
$this.Heading = $popped.Heading
12+
return $this

0 commit comments

Comments
 (0)