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 Jen Poole is licensed under a Creative Commons 4.0 Unported License. Based on a work at www.BootstrapWorld.org. Permissions beyond the scope of this license may be available by contacting schanzer@BootstrapWorld.org.