1 Let’s define a function sun
to write SUNSHINE in whatever color and size we give it!
If I say sun(5, "blue")
, what would our actor need to say?
Let’s write a few more examples:
sun( , ) →
sun( , ) →
sun( , ) →
What changes in these examples? Name your variable(s):
Let’s define our function using the variable(s):
fun sun( , ): end
2 Let’s define a function me
to generate your name in whatever size and color we give it!
If I say me(18, "gold")
, what would our actor need to say?
Let’s write a few more examples:
me( , ) →
me( , ) →
me( , ) →
What changes in these examples? Name your variable(s):
Let’s define our function using the variable(s):
fun me( , ): end
3 Let’s define a function gr
to build a solid, green rectangle of whatever height and width we give it!
If I say gr(10, 80)
, what would our actor need to say?
Let’s write a few more examples:
gr( , ) → rectangle( , , "solid", "green")
gr( , ) → rectangle( , , "solid", "green")
gr( , ) → rectangle( , , "solid", "green")
What changes in these examples? Name your variable(s):
Let’s define our function using the variable(s):
fun gr( , ): end
4 Add these new function definitions to your gt Starter File and test them out!
These materials were developed partly through support of the National Science Foundation, (awards 1042210, 1535276, 1648684, 1738598, 2031479, and 1501927). 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.