Syntax

To use methods on algebras that are not constructors (constructors are explained in Picture Object) you would usually use syntax.

The standard import for syntax is

import doodle.syntax.all.*

Say we want to use the beside method on Layout. First we need some pictures to layout.

val left = Picture.circle(10)
val right = Picture.circle(20)

Then, with the syntax imported, we can just call the beside method as if it's a method on Picture.

left.beside(right)

As with constructors, syntax methods will return a Picture not a Drawing.

Frame and Canvas→