# 2.4. Blocks (Functions)¶

Functions (also called subprocedures or in BYOB, Blocks) are a powerful tool for building abstractions and reusing code.

The video below introduces them in BYOB:

### Checkpoint Exercise

Triangle Block:

Make a block that draws a triangle. It should look like the picture below and clicking it should result in the sprite drawing a triangle.

Flexible Block:

Make a block (or modify your last one) that draws a triangle of a specified size. It should look like the picture below and clicking it should result in the sprite drawing a triangle where each side is the length specified in the parameter (input hole in the block).

Note

You should NOT use Ask [ ] and wait block inside the draw triangle block. The input to the block should come from the parameter (hole where a value can be placed).

Multiple Triangles:

Make a block that draws a number of triangles that you can specify via a parameter.

This: should result in

Note

You should NOT use Ask [ ] and wait block inside the draw triangles block. The input to the block should come from the parameter (hole where a value can be placed).