square()

Square - Draws a square with the given inputs

Example

square(100, 100, 200)

Syntax

square(x, y, length)
InputDescription

x

x co-ordinate of the bottom left corner

y

y co-ordinate of the bottom left corner

length

length of the square (length in x direction and y direction)

Description

square() draws a square on the canvas, using the inputs to determine the position and dimension of the shape. The corners can be given a curvature in order to draw a 'rounded square', but the length and height of the square must always be equal to one another. Also, the length and height need to be parallel to the x-axis and y-axis respectively - this can only be changed separately with a rotation.

Find these documents helpful? Let the people who made them help your child learn to code at Strivemath!

We'd love to hear your Feedback/Comments here.

Last updated