Functions with return values

When I discussed this I told students to think about how the highway has a minimum of 45 mph and a maximum of 60 mph. I told them to pretend they had a car that would force the speed up to 45 if the driver drove less than 45 mph. If the driver went over 60, it would slow the car down to 60. Any speed between 45 and 60 would be stay as is.

The park ride is good but you will need a high input. Some rides do have a height maximum (not more than 76" say) so it would work for that.

I also had them look at the website below and remove the constrain toward the bottom (on this website constrain is already a function in the library.)

https://p5js.org/examples/input-constrain.html

1 Like