Referenced from lesson Applying Functions

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 does the triangle function produce? (Numbers? Strings? Booleans?)

Catching Bugs

The following lines of code are all BUGGY! Can you spot the mistake? If you have time, type in the buggy code and see if Pyret agrees with you!

5)

triangle(20, "solid" "red")

Can you spot the mistake?

What error message does Pyret return?

6)

triangle(20, "solid")

Can you spot the mistake?

What error message does Pyret return?

7)

triangle(20, 10, "solid", "red")

Can you spot the mistake?

What error message does Pyret return?

8)

triangle (20, "solid", "red")

Can you spot the mistake?

What error message does Pyret return?

9)

triangle 20, "solid", "red")

Can you spot the mistake?

What error message does Pyret return?

These materials were developed partly through support of the National Science Foundation, (awards 1042210, 1535276, 1648684, and 1738598). CCbadge Bootstrap:Integrated Oklahoma 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.