Referenced from lesson Contracts (Spring, 2021)

Type this line of code into the interactions area and hit "Enter":

(triangle 50 "solid" "red")

1

What is the name of this function?

2

What did the expression evaluate to?

3

How many arguments does triangle expect?

4

What data type does the triangle function produce?
(Numbers? Strings? Booleans?)

Catching Bugs

5 (triangle 20 "solid")

triangle: expects 3 arguments, but given 2: 20 solid at: line 1, column 0, in <interactions>

Can you spot the mistake?

6 (triangle "solid" "red" 20)

triangle: expects a non-negative number as 1st argument, but given: solid; other arguments were: red 20 at: line 1, column 0, in <interactions>

Can you spot the mistake?

7 (triangle 20 40 "solid" "red")

triangle: expects 3 arguments, but given 4: 20 40 solid red at: line 1, column 0, in <interactions>

Can you spot the mistake?

8 (triangle 20 solid "red")

solid: this variable is not defined at: line 1, column 0, in <interactions>

Can you spot the mistake?

9 (triangle 20 "striped" "red")

triangle: expects a style ("solid" / "outline") or an opacity value [0-255]) as 2nd argument, but given: "striped"; other arguments were: 20 "red" at: line 1, column 0, in <interactions>

Can you spot the mistake?

These materials were developed partly through support of the National Science Foundation, (awards 1042210, 1535276, 1648684, and 1738598). CCbadge Bootstrap:Algebra by the Bootstrap Community is licensed under a Creative Commons 4.0 Unported License. This license does not grant permission to run training or professional development. Offering training or professional development with materials substantially derived from Bootstrap must be approved in writing by a Bootstrap Director. Permissions beyond the scope of this license, such as to run training, may be available by contacting contact@BootstrapWorld.org.