Create PT - "On Event" question

#1

This is my first year teaching AP CSP. I have read that the students can’t use an “On Event” as an algorithm or abstraction for their Create PT. Can they use a function that has an “On Event” inside of it?

0 Likes

#2

Yes you could, although you would not place an onEvent inside a function, you would call the function within the onEvent callback function.

If your function has no parameters, it becomes simply:
onEvent(“id”, “click”, amazingAbstractedAlgorithm);

It may be my poor imagination, but I do not think it would be easy to show an abstracted function that takes no parameters.

The important thing is that students don’t reference the onEvent that the function is called in, but the function description itself, which in most all cases will be out of the onEvent block.

0 Likes