forward
Canonical ID: turtle.forward. Nederlands: vooruit.
Moves the turtle by a signed distance along its current heading. A positive distance goes forward and a negative one backward. Movement draws only when the pen is down. The initial turtle is centered and faces up. No separate backward function is needed.
Signature
forward(distance)
Arguments
| Parameter | Type | Requirement |
|---|---|---|
distance |
Number | Finite signed distance in turtle scene units. |
Return value
None.
Example
# language: en
forward(80)
right(90)
forward(-40)
Draws forward, turns, then moves backward along the new heading.
Notes and common mistakes
Use the function name for your source language. Its canonical ID is a shared documentation label; you do not type that ID as a call. Giving your own variable or function the same name can hide the built-in. Supply the documented arguments and value types. Pliro reports mismatches when checking can detect them, or when the call runs.
A host is the app or environment running your program. To see a drawing, it needs a renderer, the part that draws on screen. The command-line command pliro run shows text but does not draw these graphics. The host support table explains which effects work in the IDE, browser, native app, and phone preview. A native build reports an unsupported capability instead of leaving it out.
The initial turtle is centered, facing up, with its pen down. State can persist between explicit IDE runs; Reset Scene restores it. Portable compositing with immediate scene graphics is not yet specified, so use a consistent drawing mode when comparing hosts.
Related entries
right · left · penUp · penDown · clear · Programming guides · Host support · Calls and arguments
