To help you with this page, we’ve re-printed the Contract for the text function, and an example of how to use it.

(Don’t forget, you can always refer to the Contracts Pages. If you’re working with a printed workbook, they are included in the back.)

# text :: (Stringmessage, Numbersize, Stringcolor) -> Image

text​(​"hello", 24, "green"​)

1 On the three lines below, write the code to lookup the value of the species column from dog-row, old-row, and young-row.

2 On the three lines below, write the code that uses the text function to show the species of those same three rows in red, 15px letters.

3 When you are confident with the code you have written, check with your partner or another student. Do you have the same code? Why or why not?

Instead of writing this out over and over for each animal, let’s define a function to do it for us!

Defining the Function

Define a function called species-tag, which takes in a row from the Animals Table and draws its name in red, 15px letters. HINT: Use of the rows from above in your examples!

Contract and Purpose Statement

Every contract has three parts…​

species-tag::Row->Image

_

Examples

Write some examples, then circle and label what changes…​

examples:

___________ (_______) is ___________________________________

___________ (_______) is ___________________________________

end

Definition

Write the definition, giving variable names to all your input values…​

fun species-tag(_):

_____________________________

end

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