美文网首页
scratch programming-function(2)-

scratch programming-function(2)-

作者: 思求彼得赵 | 来源:发表于2020-08-14 02:14 被阅读0次

2020-08-12
in the last class, we have used the function to program. and we know that in Scratch, it means we make our own function through make a new block.
In this class, we will transfer parameters to the function, and in this way, the interactivity will be increased.


this function will draw a polygon with the input parameters: length and number.


image.png

we should program this function.


image.png
the function will be used in the main program shown below.
image.png

the cat will ask you the parameters. and when you input the parameters, it will begin to draw the polygon.

it seems that we can involve all the codes into the main program. but that will make the main program longer and less readable.
so it would be better to use the function to make the program more clear and clean.

please try it.
https://scratch.mit.edu/projects/417238841

image.png

相关文章

网友评论

      本文标题:scratch programming-function(2)-

      本文链接:https://www.haomeiwen.com/subject/jcxpdktx.html